Early warning method for ship navigation illegal risk and electronic equipment

By combining spatiotemporal graph neural networks and the DBSCAN/COSTI algorithm, real-time prediction of ship navigation trajectories and automatic early warning of illegal risks are achieved, solving the problem of low efficiency of manual judgment in existing technologies and improving the accuracy and efficiency of early warning.

CN121747299APending Publication Date: 2026-03-27JIMEI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-31
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Current technologies for monitoring illegal activities by ships rely on manual judgment, which is inefficient, inaccurate, and makes it difficult to provide early warnings.

Method used

By collecting dynamic and static data of ships, real-time trajectory prediction is performed using a spatiotemporal graph neural network, and the data is matched with historical illegal trajectories. The DBSCAN and COSTI algorithms are combined to perform trajectory clustering and feature extraction, and the spatial overlap is calculated to determine the danger level, thereby achieving automatic early warning.

Benefits of technology

It improves the accuracy and efficiency of early warning of ship violations, enabling the early identification of potential illegal activities and ensuring maritime safety.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121747299A_ABST
    Figure CN121747299A_ABST
Patent Text Reader

Abstract

The invention provides a ship navigation illegal risk early warning method and electronic equipment. The method comprises the following steps: collecting ship AIS data, ship electronic chart data and meteorological data, and pre-determining a historical illegal trajectory according to collected historical illegal event database data; according to the AIS data, the electronic chart data of the ship and the meteorological data, carrying out real-time prediction on the navigation trajectory of the target ship based on a space-time diagram neural network, and obtaining a predicted trajectory of a first predetermined duration in the future; matching the predicted trajectory with a historical illegal trajectory, and obtaining a spatial coincidence ratio of the two trajectories; and determining the danger level of the target ship according to a pre-divided corresponding relationship between the space overlap ratio and the danger level. By using the above technical scheme, the possible illegal ship is predicted in advance by matching the historical illegal trajectory with the predicted real-time trajectory, and compared with an artificial discrimination early warning method, the method is more accurate and reliable and has perspectiveness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of ship early warning technology and traffic safety, and in particular to an early warning method and electronic device for the risk of illegal navigation by ships. Background Technology

[0002] The number of import and export vessels in my country has maintained a rapid growth rate. While maritime transport promotes trade and drives economic development, it also faces complex management challenges. For example, there are difficulties in supervising illegal vessels, especially the need for early warning of vessels with potential for violations. Currently, the assessment of a vessel's potential for violations relies mainly on manual labor, which is highly dependent on human intervention and inefficient. Summary of the Invention

[0003] Embodiments of the present invention provide a method and electronic device for early warning of ship navigation violation risks, which can predict possible illegal ships in advance by matching historical violation trajectories with predicted real-time trajectories.

[0004] To achieve the above objectives, on the one hand, a method for early warning of illegal navigation risks of ships is provided, including: Step 10): Collect dynamic and static AIS data of the vessel, electronic chart data and meteorological data of the vessel, and historical violation trajectories predetermined based on the collected historical violation event database; the historical violation event database data includes: the vessel's position, draft, time, speed and heading; the historical violation trajectory is identified by the trajectory points, stopping positions and trajectory shape contained therein; the dynamic AIS data includes: historical and real-time vessel heading, speed, turning rate, draft, navigation status, vessel position coordinates and timestamp; Step 20): Based on the dynamic AIS data, the ship's electronic chart data and meteorological data, the navigation trajectory of the target ship is predicted in real time using a pre-trained spatiotemporal graph neural network to obtain the predicted trajectory for the first predetermined time period in the future. Step 30): Match the predicted trajectory with the historical violation trajectory and obtain the spatial overlap between the two. Step 40): Determine the hazard level of the target vessel based on the pre-defined correspondence between spatial overlap and hazard level; wherein, the higher the spatial overlap, the higher the corresponding hazard level. Preferably, after determining the corresponding hazard level, a warning corresponding to the hazard level is issued.

[0005] Preferably, in the early warning method, step 30) includes: TS2Vec behavioral feature vectors are extracted from the predicted trajectory to obtain 128-dimensional predicted trajectory features; The historical violation trajectories are clustered by spatial patterns using DBSCAN to obtain K spatial pattern clusters. TS2Vec behavioral feature vectors are extracted from the trajectories within each cluster. Based on the extracted TS2Vec behavioral feature vectors, K dynamic prototypes are generated using the COSTI algorithm. Each dynamic prototype includes a 128-dimensional vector, representing the feature center of a type of violation trajectory. Calculate the cosine similarity between the predicted trajectory features and each dynamic prototype, and select the M dynamic prototypes with the largest cosine similarity, where M is less than or equal to K. Obtain all similar historical violation trajectories associated with each of the M dynamic prototypes, and extract a segment of the first predetermined duration from each similar historical violation trajectory. Preferably, M is less than K. In specific implementation, the M dynamic prototypes are selected by sorting according to the size of the cosine similarity or by directly selecting the M dynamic prototypes with a similarity greater than the predetermined threshold. The local alignment distance between the predicted trajectory and each captured segment is calculated using Soft-DTW. Based on the cosine similarity and local alignment distance of the extracted segments, the overall matching score MatchScore for each segment is calculated, and the segment with the highest score is selected as the optimal matching result. MatchScore=λS k +(1-λ) ; Where λ is the weight, S k Let k be the cosine similarity of the extracted segment k. This is the local alignment distance corresponding to the extracted segment k;

[0006] Calculate the spatial overlap P between the optimal matching result and the predicted trajectory, where:

[0007] N represents the total number of trajectory points in the predicted trajectory, and M represents the number of trajectory points whose spatial distance between the optimal matching result and the predicted trajectory is less than a preset first distance threshold. These trajectory points whose spatial distance between the optimal matching result and the predicted trajectory is less than the preset first distance threshold can also be referred to as coincident points.

[0008] Preferably, in the aforementioned early warning method, the spatiotemporal graph neural network comprises: a spatial graph attention network, a temporal convolutional network, and an environment fusion module, wherein the environment fusion module comprises a multilayer perceptron, and step S20) comprises: Using each ship within the selected monitoring area as a node, the node characteristics of each node are obtained. Based on the real-time distance between each node, an edge is constructed between two nodes whose real-time distance is less than a predetermined second distance threshold, resulting in a dynamic graph structure G(V, E) of the ship spatiotemporal interaction graph. Here, V is the set of nodes and E is the set of edges. The node characteristics include: position, speed, heading, ship type, and draft. The dynamic graph structure is input into a pre-trained spatiotemporal graph neural network, and the interaction weights between nodes are calculated through a spatial graph attention network, outputting the ship interaction feature Z. GAT The temporal convolutional network captures the long-term dependencies of each node's motion and outputs temporal features Z. TCN The electronic nautical chart data and meteorological data of the vessel are input into the environmental fusion module and encoded into global feature Z using a multilayer perceptron. env ; ship interaction characteristics Z GAT Time-series characteristics Z TCN and global features Z env Perform layer normalization to obtain the processed features Z; where Z = LayNorm(Z GAT +Z TCN +Z env The target ship's trajectory is predicted in real time using the feature Z after the operation.

[0009] Preferably, the early warning method uses historical AIS data to train the spatiotemporal graph neural network, and during training, the mean square error between the predicted trajectory and the actual trajectory is used as the loss function for real-time prediction of the target ship's navigation trajectory.

[0010] Preferably, the early warning method further includes: When the average trajectory error for a predetermined number of consecutive prediction periods exceeds a predetermined error threshold, an incremental learning process is automatically triggered to update the model parameters of the spatiotemporal graph neural network using the latest collected data.

[0011] Preferably, in the early warning method, step 20) includes not only the main task of real-time prediction of the target ship's navigation trajectory, but also an auxiliary task of predicting the target ship's speed changes and the probability of entering dangerous areas. When training the spatiotemporal graph neural network, binary cross-entropy loss is used as the loss function for the auxiliary task, and multi-task prediction is achieved through joint optimization of multi-task loss functions.

[0012] Preferably, the early warning method further includes one or more of the following: The static AIS data includes one or more of the following: vessel name, IMO number, vessel type, length, and beam. The electronic nautical chart data includes one or more of the following: basic geographic features, hydro-meteorological information, and traffic situation data; The meteorological data includes one or more of the following: wind speed, air pressure, and wave height; The trajectory shape is identified by curvature features; When the ship's speed is less than a predetermined speed threshold for a second predetermined time, the corresponding position will be determined as the stopping position.

[0013] Preferably, the early warning method, by clustering the historical violation trajectories according to spatial patterns using DBSCAN, includes: The neighborhood radius ε and the minimum number of points MinPts in the neighborhood are pre-defined based on the spatial distribution of the trajectory points. Traverse all illegal trajectory points in the historical illegal trajectory, calculate the number of points in its ε-neighborhood for each illegal trajectory point, and identify the illegal trajectory points whose calculated number of points is greater than or equal to MinPts as core points, and identify the non-core points in the ε-neighborhood of the core points as boundary points. Starting from the core point, continuously expand its neighborhood, merge the core points and boundary points in the neighborhood into a cluster, until all core points have been processed, resulting in different clusters of illegal trajectories.

[0014] Preferably, in the aforementioned early warning method, wherein, When the spatial overlap is less than the first overlap threshold, the hazard level is basically safe; When the spatial overlap is greater than or equal to the first overlap threshold and less than the second overlap threshold, the hazard level is mild hazard, where the first overlap threshold is less than the second overlap threshold. When the spatial overlap is greater than or equal to the second overlap threshold and less than the third overlap threshold, the hazard level is moderate hazard, and the second overlap threshold is less than the third overlap threshold. When the spatial overlap is greater than or equal to the third overlap threshold and less than the fourth overlap threshold, the danger level is high danger, and the third overlap threshold is less than the fourth overlap threshold. When the spatial overlap is greater than the fourth overlap threshold, the danger level is extremely dangerous.

[0015] In practice, the aforementioned overlap thresholds are preset according to actual conditions. Preferably, the first overlap threshold is 20%; the second overlap threshold is 30%; the third overlap threshold is 50%; and the fourth overlap threshold is 70%.

[0016] On the other hand, an electronic device is also provided, including a memory and a processor, the memory storing at least one program, the at least one program being executed by the processor to implement the steps of any of the warning methods described above. The above technical solution has the following technical effects: The ship navigation risk warning method based on historical trajectory matching in this invention predicts the ship's navigation trajectory in real time and matches it with a historical database of ship violations to obtain the degree of overlap and determine the degree of danger. It can effectively warn of possible illegal ships, improve the accuracy of identifying the possibility of ship violations and the efficiency of prediction, and has practical application value in ensuring maritime safety.

[0017] Specifically, one technical solution of this invention employs a spatiotemporal graph neural network (ST-GNN) to explicitly model the interaction behavior between ships and environmental influencing factors, which can more accurately predict ship trajectories in complex marine environments compared to traditional methods. It achieves efficient and accurate trajectory matching through hierarchical processing of DBSCAN and COSTI: DBSCAN completes spatial pattern clustering during the historical data preprocessing stage, reducing the complexity of the original data; COSTI dynamically maintains prototype centers based on behavioral feature vectors during the real-time matching stage, achieving efficient online matching. These two technologies, targeting "spatial patterns" and "behavioral features" respectively, form a complete technical chain from data cleaning to real-time early warning, ensuring both the structured processing of historical data and adapting to the real-time matching needs in dynamic scenarios. Overall, this invention achieves automatic early warning of ship violation risks, which is more accurate, reliable, and forward-looking compared to manual judgment-based early warning methods. Attached Figure Description

[0018] Figure 1 This is a flowchart illustrating a method for early warning of illegal navigation risks of ships according to an embodiment of the present invention. Figure 2 This is a schematic flowchart illustrating a specific implementation of a method for early warning of illegal navigation risks of ships according to an embodiment of the present invention. Figure 3 This is a schematic diagram illustrating the process of using a spatiotemporal graph neural network to predict the navigation trajectory of a target ship in real time in an early warning method according to an embodiment of the present invention. Figure 4 This is a schematic diagram of the trajectory matching process used in an early warning method according to an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0019] To further illustrate the various embodiments, the present invention provides accompanying drawings. These drawings are part of the disclosure of the present invention, primarily used to illustrate the embodiments and to explain the operating principles of the embodiments in conjunction with the relevant descriptions in the specification. With reference to these drawings, those skilled in the art should be able to understand other possible implementations and the advantages of the present invention. Components in the drawings are not drawn to scale, and similar component symbols are generally used to represent similar components.

[0020] The present invention will now be further described in conjunction with the accompanying drawings and specific embodiments.

[0021] In researching the technical problem of this application, the inventors discovered that in the field of maritime regulatory technology, it has been proven that illegal vessels exhibit certain similarities and regularities in their navigation trajectories. Some vessels that have engaged in illegal activities have repeatable characteristics in their navigation routes, docking locations, and sailing times. Therefore, by matching real-time predicted vessel navigation trajectories with historical illegal vessel navigation trajectories, it is possible to issue corresponding warnings based on the level of danger, thereby achieving the goal of judging the possibility of vessel violations in advance.

[0022] Example 1: Figure 1 This is a flowchart illustrating a method for early warning of illegal navigation risks of ships according to an embodiment of the present invention. Figure 2 This is a schematic flowchart illustrating a specific implementation of a method for early warning of illegal navigation risks of ships according to an embodiment of the present invention. The following is in conjunction with... Figure 1 and Figure 2 The implementation process of the early warning method for ship navigation violation risks according to an embodiment of the present invention is described.

[0023] like Figure 1 and Figure 2 The implementation of the early warning method for ship navigation violation risks according to embodiments of the present invention includes the following steps: Step 10) Collect dynamic and static AIS data of the vessel, electronic chart data and meteorological data of the vessel, and historical violation trajectories predetermined based on the collected historical violation event database data; the historical violation event database data includes: the vessel's position, draft, time, speed and course; the historical violation trajectory is identified by the trajectory points, stopping positions and trajectory shape contained therein; the dynamic AIS data includes: historical and real-time vessel course, speed, turning rate, draft, navigation status, vessel position coordinates and timestamp.

[0024] In one specific implementation, the collected time data is cleaned and processed before being input into the corresponding spatiotemporal graph neural network for trajectory prediction.

[0025] In one specific implementation, static AIS data includes one or more of the following: ship name, IMO number, ship type, length, and beam; electronic chart data includes one or more of the following: basic geographic features, hydro-meteorological information, and traffic situation data; meteorological data includes one or more of the following: wind speed, air pressure, and wave height; wherein, the trajectory shape is identified by curvature features; the stopping position in the trajectory is determined by the following steps: calculating the rate of change of ship speed at adjacent time points, and determining the position where the rate of change of ship speed is less than a predetermined speed threshold for a predetermined second time duration as the stopping position.

[0026] Preferably, it also includes related features such as the number of times a person stays and the duration of their stay.

[0027] In one specific implementation, historical violations are obtained from the maritime administration department's Automatic Identification System (AIS), port monitoring system, and law enforcement records to create a historical violation database. After obtaining the raw data from the historical violation database, data cleaning and preprocessing are performed to remove noise and outliers. Then, key features such as trajectory shape, speed changes, and stopping positions are extracted, and a clustering algorithm (DBSCAN) is used to cluster the violation trajectories, providing structured historical trajectories for subsequent behavioral feature encoding.

[0028] Specifically, for example, the original data is first processed in a unified format, such as smoothing the trajectory through moving average filtering and median filtering, and outliers are filtered out, such as using the 3σ principle to remove outliers such as sudden changes in speed and positioning.

[0029] The ship's trajectory is represented as a series of discrete points in a geographic coordinate system. A smooth trajectory curve is obtained through curve fitting, such as spline curve fitting. Features such as curvature and tortuosity of the curve are then extracted to describe the trajectory shape. The curvature feature is extracted using the following formula: , in, , The first derivative of the trajectory, , The second derivative of the trajectory is given by the formula, which quantifies the curvature of the trajectory. K is the quantized curvature of the trajectory.

[0030] Based on ship speed data recorded at adjacent time points, the rate of change of speed, i.e., acceleration, is calculated. The increase or decrease of speed over different time periods, as well as the frequency of speed changes, are analyzed. A speed threshold is pre-set. When the ship's speed is below this threshold and remains below it for a preset period, such as 30 minutes, the position information at this time is recorded as the stopping position. In specific implementations, for example, if the speed threshold is 1 knot, when the speed is less than 1 knot, the ship is considered to be in a stopping state, the corresponding position is marked as the stopping position, and the frequency of stopping is counted.

[0031] In one specific implementation, a speed threshold is set. When the ship's speed satisfies the integral condition: And duration At that time, it was determined to be a stop point. and These are the points in time, one after the other.

[0032] Step 20): Based on dynamic AIS data, ship electronic chart data and meteorological data, the navigation trajectory of the target ship is predicted in real time using a pre-trained spatiotemporal graph neural network to obtain the predicted trajectory for the first predetermined time period in the future.

[0033] Figure 3 This is a schematic diagram illustrating the process of using a spatiotemporal graph neural network to predict the navigation trajectory of a target ship in real time, according to one embodiment of the present invention.

[0034] In one specific implementation, the Spatiotemporal Graph Neural Network (ST-GNN) includes: a Spatial Graph Attention Network (GAT), a GAT module for ship interaction analysis; a Temporal Convolutional Network (TCN), a TCN module for temporal trajectory analysis; and an environment fusion module for fusing relevant environmental data, including meteorological and ocean current data, etc. The environment fusion module includes a multilayer sensor, and step S20 includes: Constructing a ship spatiotemporal interaction graph: Taking each ship within the selected monitoring area as a node, obtain the node characteristics of each node, and based on the real-time distance between each node, construct edges between two nodes whose real-time distance is less than a predetermined second distance threshold to obtain the dynamic graph structure G(V, E) of the ship spatiotemporal interaction graph; where V is the set of nodes and E is the set of edges; node characteristics include: position, speed, heading, ship type, and draft; the edges identify the potential interaction relationships between nodes; in one specific implementation, the second distance threshold is 3 nautical miles; in another specific implementation, the graph structure is dynamically updated every predetermined number of seconds, such as every 10 seconds, to reflect changes in ship position; In one specific implementation, the feature vector of each node is: These represent longitude, latitude, speed (knots), heading (degrees), ship type, and draft (meters), respectively. The system calculates the real-time distance between ships and sets a distance threshold. In the ocean, for two nodes whose distance is less than a distance threshold, an undirected edge is established between them to represent a potential interaction. Real-time AIS data, meteorological data (such as wind speed and air pressure), and satellite remote sensing ocean current data are integrated. Distances are recalculated based on the latest ship positions, and the edge connections in the graph are dynamically updated to reflect real-time changes in ship interactions. In one specific implementation, the AIS data is updated every 10 seconds.

[0035] The interaction weights between ships are calculated using a graph attention network (GAT) to identify the surrounding ships that have the greatest impact on the target ship; a temporal convolutional network (TCN) is used to model the ship's own motion sequence to capture long-term dependencies; and an environment fusion module integrates global features such as weather and ocean currents with node features.

[0036] In one specific implementation, the predicted trajectory for a predetermined future duration, such as 30 minutes, is output, along with the predicted speed change trend and the probability of entering dangerous areas; that is, multi-task prediction is performed. Figure 3 As shown. Multi-task prediction includes: primary task, trajectory prediction; auxiliary tasks, velocity prediction and danger zone prediction. In one specific implementation, the 30-minute predicted trajectory includes 180 trajectory points. When a typhoon warning is detected (wind speed ≥ 32.7 m / s), the extreme weather trajectory simulation module is automatically activated to enhance prediction robustness.

[0037] Inputting the dynamic graph structure into a pre-trained spatiotemporal graph neural network includes: calculating the interaction weights between nodes using a spatial graph attention network (GAT) to capture the interaction effects between nodes, and outputting the ship interaction features Z. GAT The temporal convolutional network captures the long-term dependencies of each node's motion and outputs temporal features Z. TCN This involves using dilated convolution to capture the long-term temporal dependence of the ship's own motion; inputting the ship's electronic chart data and meteorological data into the environment fusion module, and encoding them into global features Z using a multilayer perceptron. env This refers to global environmental features, used for fusion with node features; and the ship interaction features Z... GAT Time-series characteristics Z TCN and global features Z env Perform layer normalization to obtain the processed features Z; where Z = LayNorm(Z GAT +Z TCN +Z env ).

[0038] In one specific implementation, historical AIS data is used to train the spatiotemporal graph neural network. During training, the mean squared error between the predicted trajectory and the actual trajectory is used as the loss function for real-time prediction of the target ship's navigation trajectory.

[0039] In one specific implementation, the method further includes: when the average trajectory error for a predetermined number of consecutive prediction periods exceeds a predetermined error threshold, an incremental learning process is automatically triggered to update the model parameters of the spatiotemporal graph neural network using the latest collected data.

[0040] In one specific implementation, step 20) includes not only the main task of predicting the target ship's navigation trajectory in real time, but also an auxiliary task of predicting the target ship's speed changes and the probability of entering dangerous areas. When training the spatiotemporal graph neural network, binary cross-entropy loss is used as the loss function for the auxiliary task, and it is jointly optimized through multi-task loss functions.

[0041] In one specific implementation, the attention weights between node i and node j The calculation formula is: , in, For attention vectors, This is the transpose of the attention vector. For learnable parameters, , Let i and j be the node characteristics, respectively. Let be the set of neighboring nodes of node i. Let represent the node features of node k, a neighbor of node i. LeakyReLU is the activation function, and the double vertical lines represent vector concatenation operators. The output features of the ship after GAT processing are: .

[0042] Temporal Convolutional Network (TCN): Uses dilated convolution to capture the long-term dependence of a ship's own motion and outputs temporal features. .

[0043] Environment fusion module: Encodes meteorological and ocean current data into global features using a multilayer perceptron. , Fusion with node features: , The fused Z is used for multi-task prediction.

[0044] Multi-task prediction: The primary task predicts the trajectory (180 points) over the next 30 minutes, while the auxiliary task predicts speed changes and the probability of entering dangerous areas. The loss function is: , in, For trajectory prediction loss, To predict loss based on speed, Predicting losses in dangerous areas, , and For the corresponding task weight, Let be the predicted position coordinates at time step t. Here are the actual position coordinates at the t-th time step; express and The square of the Euclidean distance between them. In a specific implementation, when a typhoon warning is detected, such as wind speed ≥32.7m / s, the preset extreme weather trajectory simulation module is automatically activated to enhance the robustness of the prediction.

[0045] Online learning mechanism: When the prediction error exceeds the threshold continuously, incremental learning is automatically started to update the model parameters using the latest data to adapt to dynamic changes in the navigation mode.

[0046] The model is trained using historical AIS data. The main task loss function is the mean squared error (MSE) between the predicted and actual trajectories, while the auxiliary task uses the binary cross-entropy (BCE) loss. In one implementation, the total loss is... .in, ; and The corresponding weights are preset and can be adjusted according to different situations or regional differences.

[0047] After system deployment, a monitoring mechanism is established. When the average trajectory error over five consecutive prediction periods exceeds a predetermined distance threshold (e.g., 0.2 nautical miles), an incremental learning process is automatically triggered. The system collects a predetermined number of high-quality trajectory data points (e.g., 1000) in the recent period and fine-tunes the model in the background, updating its network parameters to adapt to new navigation modes or environmental changes.

[0048] Step 30) Match the predicted trajectory with the historical violation trajectory and obtain the spatial overlap between the two; Figure 4 This is a schematic diagram of the trajectory matching process used in one embodiment of the present invention; In one specific implementation, step 30) includes: TS2Vec behavioral feature vectors are extracted from the predicted trajectory to obtain 128-dimensional predicted trajectory features; Historical violation trajectories are clustered by spatial patterns using DBSCAN to obtain K spatial pattern clusters. TS2Vec behavioral feature vectors are extracted from the trajectories within each cluster. Based on the extracted TS2Vec behavioral feature vectors, K dynamic prototypes are generated using the COSTI algorithm. Each dynamic prototype includes a 128-dimensional vector, representing the feature center of a class of violation trajectories. Calculate the cosine similarity between the predicted trajectory features and each dynamic prototype, and select the M dynamic prototypes with the largest cosine similarity, where M is less than or equal to k. Obtain all similar historical illegal trajectories associated with each of the M dynamic prototypes, and extract a segment of a first predetermined duration from each similar historical illegal trajectory. Soft-DTW is used to calculate the local alignment distance between the predicted trajectory and each captured segment; Based on the cosine similarity and local alignment distance of the extracted segments, the overall matching score MatchScore for each segment is calculated, and the segment with the highest score is selected as the optimal matching result. MatchScore=λS k +(1-λ) ; Where λ is the weight, S k Let k be the cosine similarity of the extracted segment k. Let k be the local alignment distance corresponding to the extracted segment k; in one specific implementation, The weights are dynamic and adjust adaptively based on the navigation scenario. Used to convert distance into similarity.

[0049] The following example illustrates the calculation of MatchScore: The predicted trajectory is input into the TS2Vec model (3-layer Transformer, 180 input points / 128 output dimensions) to obtain... Load the five types of dynamic prototypes maintained by COSTI. The initial prototype is generated by averaging the historical violation trajectories after DBSCAN clustering (step 10) using TS2Vec encoding. Cosine similarity with each prototype ,filter The first M prototypes are used; in this example, M=3. Based on historical data, the first 3 prototypes can cover 90% of similar illegal trajectories. A 30-minute segment overlapping with the prediction time period is extracted from the corresponding historical trajectory, and Soft-DTW is used to calculate the difference between the predicted trajectory and the candidate trajectory. In this example, the smoothing parameter This is used to avoid local distortion caused by alignment paths being concentrated at a few points; by Sorting; In this example, global pattern matching is more critical in the port scenario, therefore The weight is set to 0.6.

[0050] Calculate the spatial overlap P between the optimal matching result and the predicted trajectory, where: ; N represents the total number of trajectory points in the predicted trajectory, and M represents the number of trajectory points whose spatial distance from the optimal matching result to the predicted trajectory is less than a preset first distance threshold. In one specific implementation, the first distance threshold is 0.5 nautical miles.

[0051] In one specific implementation, clustering historical violation trajectories by spatial pattern using DBSCAN includes: The neighborhood radius ε and the minimum number of points MinPts within the neighborhood are determined based on the spatial distribution of the trajectory points; in one specific implementation, the neighborhood radius ε is adaptively determined based on the spatial distribution of the trajectory points. , , in, For trajectory points and mean The standard distance is given by ε, where n is the number of trajectory points. The value of ε allows the clustering to adapt to different sea area scales and can be determined based on the geographical scale of the ship navigation area and the data accuracy. In one specific implementation, For 1 nautical mile, The distance is 0.2 nautical miles, and MinPts=8; based on the AIS data sampling frequency of 10 seconds / time, 8 points correspond to an 80-second continuous trajectory, which can filter out instantaneous noise; Traverse all violation trajectory points in the historical violation trajectory, calculate the number of points in its ε-neighborhood for each violation trajectory point, and identify violation trajectory points whose calculated number of points is greater than or equal to MinPts as core points, and identify non-core points in the ε-neighborhood of core points as boundary points; points that are neither core points nor boundary points are noise points.

[0052] Starting from the core point, its neighborhood is continuously expanded, merging the core points and boundary points within the neighborhood into a cluster, until all core points have been processed, resulting in different clusters of illegal trajectories. This clustering only classifies the spatial distribution patterns of historical illegal trajectories, aiming to clean up noisy data, extract spatial features, and reduce the amount of raw data for subsequent matching, providing a structured subset of historical trajectories for subsequent behavioral feature encoding.

[0053] In one specific implementation, illegal trajectory clusters are used to distinguish high-frequency smuggling routes, illegal docking, and other illegal patterns. In one example, illegal features containing five typical illegal patterns are ultimately derived to facilitate accurate matching of predicted flight tracks with historical tracks.

[0054] In one specific implementation, the predicted trajectory is obtained through TS2Vec (hierarchical contrastive learning). and historical illegal trajectory Multi-scale encoding is performed, dividing the trajectory into multiple sub-sequences according to temporal granularity. Each sub-sequence is then randomly augmented, and a Transformer encoder learns the hierarchical features of the trajectory. Finally, a robust vector is generated. (i.e., predicted trajectory features) and The dimensions of (i.e., historical trajectory features) are 128.

[0055] Specifically, the formula for extracting the TS2Vec behavioral feature vector is as follows: ; in, The model parameters for TS2Vec are optimized by contrastive loss function to minimize the distance between augmented view features of the same trajectory, thereby improving the discriminative power of the features.

[0056] The historical violation trajectory features are clustered into K dynamic prototypes using COSTI (Online Dynamic Prototype Network). , The value range is [1, K]. These historical violation trajectory features are derived from each spatial pattern trajectory after DBSCAN clustering in step 10), and are encoded by TS2Vec to generate a 128-dimensional behavioral feature vector. Each prototype A 128-dimensional vector represents the "feature center" of a certain type of illegal trajectory. Comparative loss is used to optimize the feature density of similar trajectories. , in, In one specific implementation, the default is... The distinguishing factor used to adjust similarity. The smaller the value, the more the model focuses on similar features; in practice, Other values ​​can be adjusted as needed; the numerator is the current trajectory feature h and the target prototype. The similarity is calculated, with the denominator being the sum of similarities with all prototypes, and the loss function is applied. This causes similar trajectory features to cluster towards their corresponding prototypes.

[0057] When a new violation trajectory is added, the prototype is updated incrementally in real time using an exponential moving average, with the formula as follows: , in, This is the updated prototype of the illegal trajectory. This is the forgetting factor, whose default value is preset; in one specific implementation, the default is... Control the proportion of historical information retained. The larger the prototype, the more stable it is. The smaller the size, the faster it can adapt to new trajectory patterns. The newly added illegal trajectory is a feature vector encoded by TS2Vec.

[0058] In one specific implementation, the matching process between the predicted trajectory and the illegal trajectory includes the following steps: Coarse screening: Calculating the features of the predicted trajectory With each dynamic prototype cosine similarity The formula is: , in It is the inner product of two vectors, used to measure the consistency of direction; for Norm, i.e., the standardized vector length; A larger value indicates greater similarity in feature directions. (Selection) The maximum number of pre-defined prototypes, such as the first M prototypes, can quickly narrow down the candidate range and reduce the computational load of subsequent matching.

[0059] Fine-grained matching: For the M prototypes obtained from screening, extract their corresponding historical trajectory subsets, where each prototype is associated with multiple similar illegal trajectories; extract segments from the historical trajectory subset where the time range of each historical trajectory completely overlaps with the predicted trajectory. For example, if the trajectory is predicted for the next 30 minutes, only the corresponding 30-minute segment from the historical trajectory is retained; use Soft-DTW to calculate the local alignment distance between the predicted trajectory and each candidate historical trajectory. , Where A is the alignment path matrix, and its elements are... This represents the alignment weight between point i in the predicted trajectory and point j in the historical trajectory; This is the distance matrix between trajectory points; As a smoothing parameter, it is preset by default. In one implementation, the default is... This is used to avoid extreme alignment paths; Path entropy is used to measure the uniformity of alignment.

[0060] according to Sort the trajectories from highest to lowest score and select the trajectory with the highest score as the optimal matching result. Extract the segment where the time range of this trajectory overlaps with the predicted trajectory, and calculate the spatial overlap between the two.

[0061] Let N be the total number of trajectory points, and M be the number of trajectory points whose spatial distance is less than a threshold (i.e., overlapping points). The spatial distance threshold is a configurable parameter with a default value of 0.5 nautical miles. Then, the overlap formula is:

[0062] For example, N=180 is the total number of points, and M is the number of overlapping points with a spatial distance of less than 0.5 nautical miles; the first distance threshold can be adjusted to 0.2 nautical miles for dense waters and to 1 nautical mile for wide waters such as the high seas, depending on the risk level.

[0063] Step 40): Determine the hazard level of the target vessel based on the pre-defined correspondence between spatial overlap and hazard level; where the higher the spatial overlap, the higher the corresponding hazard level.

[0064] In one specific implementation, the above correspondence is shown in Table 1 below: Table 1

[0065] The overlap degree P obtained in step 30) is compared with the table above to determine the degree of danger, and a warning is issued using the corresponding response action shown in Table 1. In other implementations, the overlap degree threshold, number of danger levels, specific classifications, and response actions mentioned above can be adjusted according to actual needs.

[0066] When a warning based on this method triggers a relevant response action, and it is verified that the vessel is illegally navigating, the vessel's actual track is automatically marked as a "new illegal track" and added to the historical illegal event database in step 10). Simultaneously, an incremental update of the COSTI prototype is triggered, via the formula... ,in Forgetting factor, The dynamic prototype is updated to include the TS2Vec encoding features of newly added trajectories, enabling the system to continuously adapt to new violation patterns.

[0067] Example 2: The present invention also provides an electronic device, such as... Figure 5 As shown, the device includes a processor 501, a memory 502, a bus 503, and a computer program stored in the memory 502 and executable on the processor 501. The processor 501 includes one or more processing cores. The memory 502 is connected to the processor 501 via the bus 503. The memory 502 is used to store program instructions. When the processor executes the computer program, it implements the steps in the above-described method embodiment of Embodiment 1 of the present invention.

[0068] Furthermore, as an executable solution, the electronic device can be a computer unit, which can be a desktop computer, laptop, handheld computer, cloud server, or other computing device. The computer unit may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the above-described structure of the computer unit is merely an example and does not constitute a limitation on the computer unit. It may include more or fewer components, or combine certain components, or use different components. For example, the computer unit may also include input / output devices, network access devices, buses, etc., and this embodiment of the invention does not limit this.

[0069] Furthermore, as an executable solution, the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc. The processor is the control center of the computer unit, connecting various parts of the entire computer unit via various interfaces and lines.

[0070] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the computer unit by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created based on the use of the mobile phone, etc. In addition, the memory may include high-speed random access memory and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart media card (SMC), secure digital card (SD card), flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0071] Although the invention has been specifically shown and described in conjunction with preferred embodiments, those skilled in the art should understand that various changes in form and detail may be made to the invention without departing from the spirit and scope of the invention as defined in the appended claims, all of which shall be within the scope of protection of the invention.

Claims

1. A method for early warning of risks of illegal navigation by ships, characterized in that, include: Step 10): Collect dynamic and static AIS data of the vessel, electronic chart data and meteorological data of the vessel, and historical violation trajectories predetermined based on the collected historical violation event database; the historical violation event database data includes: the vessel's position, draft, time, speed and heading; the historical violation trajectory is identified by the trajectory points, stopping positions and trajectory shape contained therein; the dynamic AIS data includes: historical and real-time vessel heading, speed, turning rate, draft, navigation status, vessel position coordinates and timestamp; Step 20): Based on the dynamic AIS data, the ship's electronic chart data and meteorological data, the navigation trajectory of the target ship is predicted in real time using a pre-trained spatiotemporal graph neural network to obtain the predicted trajectory for the first predetermined time period in the future. Step 30): Match the predicted trajectory with the historical violation trajectory and obtain the spatial overlap between the two. Step 40): Determine the hazard level of the target vessel based on the pre-defined correspondence between spatial overlap and hazard level; where the higher the spatial overlap, the higher the corresponding hazard level.

2. The early warning method according to claim 1, characterized in that, Step 30) includes: TS2Vec behavioral feature vectors are extracted from the predicted trajectory to obtain 128-dimensional predicted trajectory features; The historical violation trajectories are clustered by spatial patterns using DBSCAN to obtain K spatial pattern clusters. TS2Vec behavioral feature vectors are extracted from the trajectories within each cluster. Based on the extracted TS2Vec behavioral feature vectors, K dynamic prototypes are generated using the COSTI algorithm. Each dynamic prototype includes a 128-dimensional vector, representing the feature center of a type of violation trajectory. Calculate the cosine similarity between the predicted trajectory features and each dynamic prototype, and select the M dynamic prototypes with the largest cosine similarity, where M is less than or equal to K. Obtain all similar historical illegal trajectories associated with each of the M dynamic prototypes, and extract a segment of the first predetermined duration from each similar historical illegal trajectory. The local alignment distance between the predicted trajectory and each captured segment is calculated using Soft-DTW. Based on the cosine similarity and local alignment distance of the extracted segments, the overall matching score MatchScore for each segment is calculated, and the segment with the highest score is selected as the optimal matching result. MatchScore=λS k +(1-λ) ; Where λ is the weight, S k Let k be the cosine similarity of the extracted segment k. This is the local alignment distance corresponding to the extracted segment k; Calculate the spatial overlap P between the optimal matching result and the predicted trajectory, where: N is the total number of trajectory points in the predicted trajectory, and M is the number of trajectory points whose spatial distance between the optimal matching result and the predicted trajectory is less than a preset first distance threshold.

3. The early warning method according to claim 1, characterized in that, The spatiotemporal graph neural network includes: a spatial graph attention network, a temporal convolutional network, and an environment fusion module. The environment fusion module includes a multilayer perceptron. Step S20 includes: Using each ship within the selected monitoring area as a node, the node characteristics of each node are obtained. Based on the real-time distance between each node, an edge is constructed between two nodes whose real-time distance is less than a predetermined second distance threshold, resulting in a dynamic graph structure G(V, E) of the ship spatiotemporal interaction graph. Here, V is the set of nodes and E is the set of edges. The node characteristics include: position, speed, heading, ship type, and draft. The dynamic graph structure is input into a pre-trained spatiotemporal graph neural network, and the interaction weights between nodes are calculated through a spatial graph attention network, outputting the ship interaction feature Z. GAT The temporal convolutional network captures the long-term dependencies of each node's motion and outputs temporal features Z. TCN The electronic nautical chart data and meteorological data of the vessel are input into the environmental fusion module and encoded into global feature Z using a multilayer perceptron. env ; ship interaction characteristics Z GAT Time-series characteristics Z TCN and global features Z env Perform layer normalization to obtain the processed features Z; where Z = LayNorm(Z GAT +Z TCN +Z env The target ship's trajectory is predicted in real time using the feature Z after the operation.

4. The early warning method according to claim 3, characterized in that, The spatiotemporal graph neural network is trained using historical AIS data. During training, the mean squared error between the predicted trajectory and the actual trajectory is used as the loss function for real-time prediction of the target ship's navigation trajectory.

5. The early warning method according to claim 4, characterized in that, Also includes: When the average trajectory error for a predetermined number of consecutive prediction periods exceeds a predetermined error threshold, an incremental learning process is automatically triggered to update the model parameters of the spatiotemporal graph neural network using the latest collected data.

6. The early warning method according to claim 3, characterized in that, In step 20), in addition to the main task of real-time prediction of the target ship's navigation trajectory, there is also an auxiliary task of predicting the target ship's speed changes and the probability of entering dangerous areas. When training the spatiotemporal graph neural network, binary cross-entropy loss is used as the loss function for the auxiliary task, and multi-task prediction is achieved through joint optimization of multi-task loss functions.

7. The early warning method according to claim 1, characterized in that, It also includes one or more of the following: The static AIS data includes one or more of the following: vessel name, IMO number, vessel type, length, and beam. The electronic nautical chart data includes one or more of the following: basic geographic features, hydro-meteorological information, and traffic situation data; The meteorological data includes one or more of the following: wind speed, air pressure, and wave height; The trajectory shape is identified by curvature features; When the ship's speed is less than a predetermined speed threshold for a second predetermined time, the corresponding position will be determined as the stopping position.

8. The early warning method according to claim 2, characterized in that, The historical violation trajectories were clustered by spatial pattern using DBSCAN, including: The neighborhood radius ε and the minimum number of points MinPts in the neighborhood are pre-defined based on the spatial distribution of the trajectory points. Traverse all illegal trajectory points in the historical illegal trajectory, calculate the number of points in its ε-neighborhood for each illegal trajectory point, and identify the illegal trajectory points whose calculated number of points is greater than or equal to MinPts as core points, and identify the non-core points in the ε-neighborhood of the core points as boundary points. Starting from the core point, continuously expand its neighborhood, merge the core points and boundary points in the neighborhood into a cluster, until all core points have been processed, resulting in different clusters of illegal trajectories.

9. The early warning method according to claim 1, characterized in that, When the spatial overlap is less than the first overlap threshold, the hazard level is basically safe; When the spatial overlap is greater than or equal to the first overlap threshold and less than the second overlap threshold, the hazard level is mild hazard, where the first overlap threshold is less than the second overlap threshold. When the spatial overlap is greater than or equal to the second overlap threshold and less than the third overlap threshold, the hazard level is moderate hazard, and the second overlap threshold is less than the third overlap threshold. When the spatial overlap is greater than or equal to the third overlap threshold and less than the fourth overlap threshold, the danger level is high danger, and the third overlap threshold is less than the fourth overlap threshold. When the spatial overlap is greater than the fourth overlap threshold, the danger level is extremely dangerous.

10. An electronic device, characterized in that, It includes a memory and a processor, the memory storing at least one program, the at least one program being executed by the processor to implement the steps of the early warning method as described in any one of claims 1 to 9.