Ship abnormal behavior detection method and device, electronic equipment and storage medium
By augmenting and standardizing ship trajectory data, pseudo-labels are generated and a neural network encoder is trained to construct a reference model of normal behavior patterns. This solves the problem of low accuracy in ship trajectory anomaly detection and achieves efficient and reliable anomaly behavior recognition.
Patent Information
- Application Number
- CN202610014727.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-07
- Publication Date
- 2026-04-10
AI Technical Summary
In existing technologies, the accuracy of ship trajectory anomaly detection is not high, the false alarm rate is high, and it is difficult to effectively identify abnormal behaviors such as illegal anchoring and dangerous approach. This is mainly due to the large amount of data, high noise, complex spatiotemporal dimensions and diverse behavioral patterns, high cost of manual annotation and inconsistent standards.
By acquiring raw ship trajectory data, performing augmentation and hybrid standardization, generating pseudo-labels, and using unsupervised clustering, a neural network encoder is trained to construct multiple reference models of normal behavior patterns. The pseudo-labels are used as supervision signals for comparative learning to generate a target trajectory encoder, and finally, anomaly determination is made by distance comparison.
It enables efficient identification of abnormal ship behavior, improves the practicality and reliability of the detection system, solves the problem of balancing accuracy and efficiency in real-time detection, avoids reliance on prior human knowledge, and improves the accuracy of detection.
Smart Images

Figure CN121838523A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent maritime monitoring technology, and in particular to methods, devices, electronic equipment and storage media for detecting abnormal ship behavior. Background Technology
[0002] In the fields of intelligent shipping and maritime safety, anomaly detection of ship trajectories is a crucial enabling technology. With the widespread adoption of Automatic Identification Systems (AIS), massive amounts of continuous trajectory data rich in navigation information have been generated. Identifying abnormal behaviors from this trajectory data, such as unauthorized anchoring, dangerous approaches, and serpentine navigation, is of great significance for achieving proactive navigation safety warnings, improving maritime regulatory efficiency, and optimizing the utilization of waterway resources.
[0003] Currently, AIS trajectory data is characterized by large data volume, high noise, complex spatiotemporal dimensions, and diverse behavioral patterns. Abnormal samples are scarce, manual annotation is extremely costly and inconsistent in standards, and the diversity of normal behavior is easily overlooked. This can easily lead to the misclassification of a certain uncommon but normal pattern as abnormal, resulting in a high false alarm rate and poor reliability of detection results.
[0004] Therefore, improving the accuracy of detecting abnormal ship behavior is a problem that urgently needs to be solved. Summary of the Invention
[0005] The main objective of this application is to provide a method, device, electronic equipment, and storage medium for detecting abnormal ship behavior, aiming to solve the technical problem of how to improve the accuracy of detecting abnormal ship behavior.
[0006] To achieve the above objectives, this application proposes a method for detecting abnormal ship behavior, the method comprising: Obtain the original ship trajectory data, and perform augmentation and hybrid standardization processing on the original ship trajectory data to obtain a standard trajectory sequence; Based on the standard trajectory sequence, pseudo-labels are generated through unsupervised clustering, and the pseudo-labels are used to represent different normal navigation modes. Using the standard trajectory sequence and the pseudo-label as supervision signals, a neural network encoder is trained through contrastive learning to obtain the target trajectory encoder; Based on the target trajectory encoder, multiple normal behavior pattern reference models are constructed according to the trajectories within each cluster corresponding to the pseudo-label. The new trajectory to be detected is input into the target trajectory encoder to generate the embedding vector to be detected, and anomaly determination is made based on the distance between the embedding vector to be detected and each of the normal behavior pattern reference models.
[0007] In one embodiment, the step of acquiring raw ship trajectory data, performing augmentation and hybrid standardization on the raw ship trajectory data to obtain a standard trajectory sequence includes: Obtain raw ship trajectory data, which includes static features, including time information, position information, speed information, and heading information; Based on the time information, position information, velocity information, and heading information, the acceleration and heading rate of change are calculated to obtain the dynamic characteristics; The static features and dynamic features are subjected to different standardization processes, and the trajectory points after different standardization processes are merged to obtain a standard trajectory sequence.
[0008] In one embodiment, the step of generating pseudo-labels based on the standard trajectory sequence through unsupervised clustering, wherein the pseudo-labels are used to represent different normal navigation modes, includes: Global statistical features are extracted from the standard trajectory sequence to form a feature vector set; The similarity between samples in the feature vector set is calculated based on the weighted Euclidean distance to obtain the overall distance distribution of the feature vector set; The neighborhood radius parameter of the clustering algorithm is determined based on the overall distance distribution of the feature vector set; Based on the local density of the trajectory data, the minimum number of samples required to define the core points in the clustering algorithm is dynamically adjusted to obtain the adjusted minimum number of samples parameter. Density clustering is performed based on the neighborhood radius parameter of the clustering algorithm and the adjusted minimum sample number parameter. Trajectories are divided into different clusters and noise points are identified to obtain pseudo-labels.
[0009] In one embodiment, the step of using the standard trajectory sequence and the pseudo-label as supervision signals to train a neural network encoder through contrastive learning to obtain a target trajectory encoder includes: A neural network encoder is built based on the Transformer architecture. The neural network encoder includes a multi-head self-attention module and a hybrid pooling module. The multi-head self-attention module is used to capture long-term spatiotemporal dependencies in the trajectory sequence. The hybrid pooling module is used to aggregate the sequence features output by the multi-head self-attention module to generate a trajectory embedding vector of fixed dimension. The multi-head self-attention module is also used to introduce a bias term based on the difference in motion state between trajectory points when calculating attention weights. The standard trajectory sequence with pseudo-labels is input into the neural network encoder to obtain an initial trajectory embedding representation; Based on the pseudo-labels, positive and negative sample pairs are selected from the initial trajectory embedding representations. The positive sample pairs are trajectory embedding representations of the same cluster, and the negative sample pairs are trajectory embedding representations of different clusters. The contrastive loss function is calculated based on the similarity of the embedding vectors of the positive and negative sample pairs to obtain the loss value; The neural network encoder is optimized based on the loss value to obtain the target trajectory encoder.
[0010] In one embodiment, the step of calculating the contrastive loss function based on the embedding vector similarity of the positive sample pair and the negative sample pair to obtain the loss value further includes: The cosine similarity is calculated by measuring the embedding vector similarity between the positive and negative sample pairs. A temperature parameter is introduced to scale the cosine similarity to obtain a scaled similarity. The scaling is used to control the attention given to difficult samples. The loss value is calculated based on the scaled similarity using the supervised contrastive loss function based on the pseudo-labels.
[0011] In one embodiment, the step of constructing multiple normal behavior pattern reference models based on the target trajectory encoder and the trajectories within each cluster corresponding to the pseudo-label includes: For each cluster, the target trajectory encoder converts all training trajectories within the current cluster into trajectory embedding vectors, resulting in a set of trajectory embedding vectors. Based on the set of trajectory embedding vectors, calculate the mean vector and covariance matrix of the current cluster; For each cluster, a multivariate Gaussian distribution model is determined based on the mean vector and covariance matrix to obtain multiple normal behavior pattern reference models. The multivariate Gaussian distribution model is used to represent the behavior pattern of the current cluster.
[0012] In one embodiment, the step of inputting the new trajectory to be detected into the target trajectory encoder to generate a detection embedding vector, and determining anomalies based on the distance between the detection embedding vector and each of the normal behavior pattern reference models, includes: The new trajectory to be detected is input into the target trajectory encoder to generate the embedding vector to be detected; Calculate the Mahalanobis distance from the embedded vector to be detected to each normal behavior reference model, and select the minimum value from all Mahalanobis distances as the anomaly score of the new trajectory to be detected. The anomaly score is compared with a preset threshold. If the anomaly score is greater than the preset threshold, the new trajectory to be detected is determined to be an abnormal behavior trajectory. The preset threshold is derived based on the statistical value of the embedding distance distribution of trajectories within each cluster during the training phase.
[0013] Furthermore, to achieve the above objectives, this application also proposes a ship abnormal behavior detection device, which includes: The data processing module is used to acquire raw ship trajectory data, perform augmentation and hybrid standardization processing on the raw ship trajectory data, and obtain a standard trajectory sequence. A pseudo-label generation module is used to generate pseudo-labels based on the standard trajectory sequence through unsupervised clustering. The pseudo-labels are used to represent different normal navigation modes. The model training module is used to train the neural network encoder by comparing the standard trajectory sequence and the pseudo-label as supervision signals to obtain the target trajectory encoder. The model building module is used to build multiple normal behavior pattern reference models based on the target trajectory encoder and the trajectories in each cluster corresponding to the pseudo-label. The anomaly detection module is used to input the new trajectory to be detected into the target trajectory encoder to generate the embedding vector to be detected, and to make anomaly detection based on the distance between the embedding vector to be detected and each of the normal behavior pattern reference models.
[0014] In addition, to achieve the above objectives, this application also proposes an electronic device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the ship abnormal behavior detection method as described above.
[0015] In addition, to achieve the above objectives, this application also proposes a non-transitory storage medium on which a computer program is stored, which, when executed by a processor, implements the steps of the ship abnormal behavior detection method described above.
[0016] One or more technical solutions proposed in this application have at least the following technical effects: The original ship trajectory data was acquired and then subjected to augmentation and hybrid standardization to obtain a standard trajectory sequence. By employing data augmentation and hybrid standardization, the problems of noise interference and scale inconsistencies in the original trajectory data were resolved, achieving data normalization and enhancement, and providing high-quality input for subsequent model training.
[0017] Based on standard trajectory sequences, pseudo-labels are generated through unsupervised clustering. These pseudo-labels are used to represent different normal navigation patterns. Generating pseudo-labels through unsupervised clustering overcomes the challenge of scarce ship behavior annotation data, automatically identifies multiple normal navigation patterns, and avoids reliance on prior human knowledge.
[0018] Standard trajectory sequences and pseudo-labels are used as supervision signals to train a neural network encoder through contrastive learning, resulting in a target trajectory encoder. Pseudo-labels are generated through unsupervised clustering, overcoming the challenge of scarce ship behavior annotation data and automatically identifying various normal navigation patterns, thus avoiding reliance on prior human knowledge.
[0019] Based on the target trajectory encoder, multiple reference models of normal behavior patterns are constructed according to the trajectories within each cluster corresponding to pseudo-labels. By using pseudo-labels as supervision signals and combining them with contrastive learning to train the encoder, the dependence on labeled data in trajectory feature representation learning is resolved, achieving more robust and discriminative feature extraction compared to traditional methods.
[0020] The new trajectory to be detected is input into the target trajectory encoder to generate the embedding vector to be detected, and anomaly determination is made based on the distance between the embedding vector to be detected and the reference models of each normal behavior pattern. Anomaly determination by distance comparison solves the problem of balancing accuracy and efficiency in real-time detection, realizes efficient identification of abnormal behavior, and improves the practicality and reliability of the detection system. Attached Figure Description
[0021] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0022] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a flowchart illustrating the first embodiment of the ship abnormal behavior detection method of this application; Figure 2 This is a schematic diagram of the neural network encoder structure of this application; Figure 3 This is a schematic diagram of the comparative learning and training process for this application; Figure 4 This is a schematic diagram of the anomaly detection and judgment logic of this application; Figure 5 This is a schematic diagram of the module structure of the ship abnormal behavior detection device of this application.
[0024] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0025] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0026] This application provides a method for detecting abnormal ship behavior. Figure 1 This is a flowchart illustrating the first embodiment of the ship abnormal behavior detection method of this application. In this embodiment, the ship abnormal behavior detection method includes steps S10 to S50:
[0027] Step S10: Obtain the original ship trajectory data, perform augmentation and hybrid standardization processing on the original ship trajectory data, and obtain the standard trajectory sequence.
[0028] It should be noted that raw ship trajectory data refers to unprocessed sequence of trajectory points directly obtained from sources such as Automatic Identification Systems (AIS). Augmentation is achieved by appropriately transforming the raw trajectory data, such as adding minor perturbations, simulating partial point loss, or applying minor spatial or temporal offsets. Augmentation processing can generate more diverse trajectory samples, thereby improving the model's generalization ability. Hybrid standardization refers to the combined use of multiple data standardization methods to unify trajectory features of different dimensions and ranges to a similar scale. Standard trajectory sequences refer to trajectory data obtained after the above augmentation and hybrid standardization processes, which are formatted uniformly and expanded in scale, and can be directly used as input to the model.
[0029] Step S20: Based on the standard trajectory sequence, pseudo-labels are generated through unsupervised clustering. The pseudo-labels are used to represent different normal navigation modes.
[0030] It's important to note that unsupervised clustering can be understood as a machine learning method that automatically divides trajectory data into different groups based solely on their inherent similarity, without any pre-defined labels. Pseudo-labels can be understood as a category label automatically assigned to each standard trajectory sequence through unsupervised clustering. It's crucial to understand that pseudo-labels are not genuine labels indicating abnormality or normality, but rather alternative labels used to distinguish different normal navigation patterns. Different normal navigation patterns refer to the regular and common movement patterns exhibited by ships in specific waters, such as in channels, anchorages, and ports. Examples include ships sailing at high speed along the main channel and ships hovering at low speed in anchorages. Each pattern corresponds to a cluster.
[0031] Step S30: Using the standard trajectory sequence and pseudo-labels as supervision signals, a neural network encoder is trained through contrastive learning to obtain the target trajectory encoder.
[0032] It's important to note that during model training, the supervision signal guides the model to learn the target information that correctly maps the relationships. The pseudo-labels and the standard trajectory sequence themselves together constitute the supervision signal. Contrastive learning is a training paradigm whose core idea is to allow the model to learn to make trajectory features under the same pseudo-label as close as possible in the representation space, while making trajectory features under different labels as far apart as possible. A neural network encoder can be understood as a specially designed neural network model used to compress and encode a variable-length standard trajectory sequence into a fixed-length, low-dimensional, dense vector. The target trajectory encoder refers to the optimal-performing neural network encoder obtained after sufficient training through contrastive learning, capable of efficiently converting trajectories into highly discriminative feature vectors.
[0033] Step S40: Based on the target trajectory encoder, construct multiple normal behavior pattern reference models according to the trajectories in each cluster corresponding to the pseudo-labels.
[0034] It should be noted that a cluster refers to each specific group formed after unsupervised clustering, where trajectories within the same group are considered to belong to the same normal navigation pattern. The normal behavior pattern reference model refers to extracting the feature vectors of all trajectories within each cluster using a target trajectory encoder, and constructing a reference baseline based on these vectors. The normal behavior pattern reference model can be as simple as the mean of the cluster's feature vectors, or it can be a more complex probability distribution model.
[0035] Step S50: Input the new trajectory to be detected into the target trajectory encoder to generate the embedding vector to be detected, and make anomaly determination based on the distance between the embedding vector to be detected and each normal behavior pattern reference model.
[0036] It should be noted that the new trajectory to be detected is new ship trajectory data that requires anomaly detection. After preprocessing, the new trajectory is input into the target trajectory encoder to obtain the embedding vector to be detected. Anomaly detection can be performed by calculating the distance between the embedding vector and each normal behavior pattern reference model.
[0037] In this embodiment, by employing data augmentation and hybrid standardization, the problems of noise interference and scale inconsistency in the original trajectory data are resolved, achieving the standardization and enhancement of the trajectory data and providing high-quality input for subsequent model training. Pseudo-labels are generated through unsupervised clustering, overcoming the difficulty of scarce ship behavior annotation data and automatically mining multiple normal navigation patterns, avoiding reliance on prior human knowledge. Using pseudo-labels as supervisory signals and combining them with contrastive learning to train the encoder solves the dependence on annotation data in trajectory feature representation learning, achieving more robust and discriminative feature extraction compared to traditional methods. Multiple normal behavior reference models are constructed based on the encoder, addressing the problem that a single model cannot cover behavioral diversity, and capturing the features of different normal patterns more precisely compared to a global model. Finally, anomaly detection is performed through distance comparison, solving the balance between accuracy and efficiency in real-time detection, achieving efficient identification of abnormal behavior, and improving the practicality and reliability of the detection system.
[0038] In one implementation, step S10 includes: Step S101: Obtain the original ship trajectory data. The original ship trajectory data includes static features, which include time information, position information, speed information, and heading information.
[0039] It should be noted that static features refer to the basic information directly carried by the trajectory points themselves. For example, this can be the raw trajectory sequence collected from the Automatic Identification System (AIS). For each trajectory sequence... ,in It includes timestamps, latitude and longitude, speed, and heading characteristics.
[0040] Step S102: Calculate the acceleration and rate of change of heading based on time information, position information, speed information, and heading information to obtain dynamic characteristics.
[0041] For example, the acceleration, heading change, and rate of heading change of the trajectory point can be calculated and obtained, and the augmented trajectory point can be obtained. in For the timestamps of the trajectory points, For the longitude and latitude of the trajectory point, The velocity of the trajectory point, Let be the heading angle of the trajectory point. The acceleration of the trajectory point. For the change in heading of the trajectory point, The rate of change of heading at the trajectory point.
[0042] Step S103: Perform different standardization processes on the static features and dynamic features respectively, and merge the trajectory points after different standardization processes to obtain a standard trajectory sequence.
[0043] It should be noted that the standard trajectory sequence is a complete sequence obtained by re-merging the static and dynamic features after standardization according to the trajectory points, resulting in a unified feature scale that can be used as model input.
[0044] For example, a hybrid standardization strategy can be adopted for different types of features. For instance, min-max standardization can be used for latitude and longitude features, while Z-score standardization can be used for dynamic motion features such as velocity, acceleration, and rate of change of heading. Each standardized trajectory sequence is then... Each standardized trajectory point .
[0045] In this implementation, dynamic features are derived by calculating acceleration and rate of change of heading, solving the problem that relying solely on instantaneous states cannot effectively characterize the continuity and intent of ship motion, thus achieving a more comprehensive and detailed description of ship behavior. Furthermore, by performing targeted standardization on static and dynamic features with different physical meanings and distributions, the problems of data distribution distortion and model training instability caused by simply mixing features of different dimensions are resolved, allowing all features to be learned by the model on a coordinated scale. Finally, by merging the separately standardized features into a unified standard trajectory sequence, a rich and high-quality input is provided to downstream models, laying a solid foundation for improving the accuracy of anomaly detection from the data source.
[0046] In one implementation, step S20 includes: Step S201: Extract global statistical features from the standard trajectory sequence to form a feature vector set.
[0047] It should be noted that global statistical features refer to statistical quantities calculated from a complete standard trajectory sequence that can summarize its overall behavior, such as average speed, speed standard deviation, total distance, and maximum turning rate. Multiple global statistical features of each trajectory are combined into a one-dimensional vector, and the vectors of all trajectories constitute the feature vector set.
[0048] For example, global statistical features can be extracted from the standardized trajectory. These extracted features may include: the latitude and longitude range of the calculated trajectory, spatial span, coordinates of key points, spatial distribution entropy, total duration, extreme values and standard deviations of velocity and acceleration, statistical changes in heading, trajectory shape, etc., forming a set of trajectory feature vectors. ,in Indicates the first Trajectory 3D statistical eigenvectors.
[0049] Step S202: Calculate the similarity between samples in the feature vector set based on the weighted Euclidean distance to obtain the overall distance distribution of the feature vector set.
[0050] It should be noted that weighted Euclidean distance is a distance metric that assigns different weights to each feature based on its importance in distinguishing behavioral patterns when calculating the Euclidean distance between vectors. The overall distance distribution refers to the statistical distribution of the weighted Euclidean distances calculated between all pairs of samples in the feature vector set.
[0051] Step S203: Determine the neighborhood radius parameter of the clustering algorithm based on the overall distance distribution of the feature vector set.
[0052] It should be noted that the neighborhood radius parameter is a core parameter in density clustering algorithms, used to define the neighborhood range of a sample point. The number of other sample points contained within the neighborhood of a sample point is the basis for determining whether that point belongs to a dense region.
[0053] Step S204: Based on the local density of the trajectory data, dynamically adjust the minimum number of samples required to define the core points in the clustering algorithm to obtain the adjusted minimum number of samples parameter.
[0054] It's important to note that in clustering, local density refers to the number of other sample points within the radius of a given sample point. A core point is a sample point whose neighborhood number reaches or exceeds the minimum sample number parameter; only core points can expand to form clusters. The minimum sample number parameter defines the minimum number of neighborhood points required to form a core point. The adjusted minimum sample number parameter refers to a parameter that is dynamically calculated based on the local density distribution of the data and is not a fixed, uniform value.
[0055] Step S205: Density clustering is performed based on the neighborhood radius parameter and the adjusted minimum number of samples parameter of the clustering algorithm. The trajectory is divided into different clusters and noise points are identified to obtain pseudo labels.
[0056] It should be noted that pseudo-labels refer to the identifiers automatically assigned to each trajectory through the density clustering process described above. These labels represent either the cluster to which the trajectory falls within the normal behavioral pattern, or it is marked as a potential anomaly.
[0057] For example, the core principle of the traditional DBSCAN algorithm is to define the neighborhood radius. and minimum sample size To identify density-connected sample sets: for a trajectory feature vector, its - Neighborhood is defined as: in Let be the distance metric function in the feature space, when hour, Points are marked as core points. These core points and points connected to them by density reachability are expanded into a cluster. Samples that cannot be included in any cluster are marked as noise points. In this application, the neighborhood radius... and minimum sample size Instead of being fixed, the similarity is dynamically calculated based on the spatial density distribution of the trajectory data. For example, in the standardized feature space, a weighted Euclidean distance can be used to calculate the similarity between trajectories, with the corresponding formula:
[0058]
[0059] Among them, weight Assigning importance based on features For the first The first of the trajectories 3D statistical features. The distance set of all trajectory pairs in the training set can be calculated, represented as:
[0060]
[0061] in, Take the first Quantiles , The selection is adaptive based on the dataset size, and the corresponding formula is:
[0062] For large datasets, the quantiles are automatically reduced to avoid overly loose density estimation; for small datasets, the quantiles are increased to prevent overly fragmented clustering. Total number of trajectories It is related to the logarithmic function, and the corresponding formula is:
[0063]
[0064] in This is a floor function that ensures integer values. This is a density adjustment factor. For high-density regions: Appropriately increase To avoid excessive cluster merging. For low-density areas: ,reduce This ensures effective clustering of sparse trajectories. Through improved DBSCAN clustering calculations and noise point removal, the cluster identifiers generated by the clustering are... ,in, Indicates the first The cluster labels of the trajectories are used as pseudo-labels for self-supervised contrastive learning. It should be noted that the scale density of the ship AIS data here involves the spatial distribution range and temporal span of the trajectory points, specifically defined as: more than 200 points / ship / day is high density, less than 200 points / ship / day is low density. A total number of trajectory points greater than 1,000,000 is considered a large dataset, and vice versa.
[0065] In this implementation, global statistical features summarizing the overall behavior of a vessel are extracted from the trajectory sequence, solving the problems of low efficiency and noise sensitivity in direct clustering of raw high-dimensional time-series data, thus achieving a more efficient and stable representation of ship behavior patterns. By employing a weighted Euclidean distance metric for similarity and analyzing the overall distance distribution in the feature space, the distortion in similarity judgment caused by inconsistent feature scales and unscientific distance metrics in traditional clustering is resolved, providing a data-driven objective basis for determining key parameters. Furthermore, the neighborhood radius is adaptively determined based on the overall distance distribution, and the minimum sample number parameter is dynamically adjusted based on local density, fundamentally solving the pain points of traditional density clustering algorithms that heavily rely on prior experience to manually set parameters and have poor generalization ability across different water areas or behavior patterns. Finally, density clustering based on these two adaptive parameters achieves more accurate and robust automatic classification of various normal navigation patterns and effectively separates sparse noise points, thereby generating higher-quality and more reliable pseudo-labels, providing a solid foundation for subsequent comparative learning.
[0066] In one implementation, step S30 includes: Step S301: Establish a neural network encoder based on the Transformer architecture.
[0067] The neural network encoder includes a multi-head self-attention module and a hybrid pooling module. The multi-head self-attention module is used to capture long-term spatiotemporal dependencies in the trajectory sequence, and the hybrid pooling module is used to aggregate the sequence features output by the multi-head self-attention module to generate a fixed-dimensional trajectory embedding vector. The multi-head self-attention module is also used to introduce a bias term based on the difference in motion state between trajectory points when calculating attention weights.
[0068] It's important to note that the multi-head self-attention module is a core component of the Transformer. It captures complex dependencies between trajectory points within a sequence from different perspectives through multiple channels in parallel, excelling at capturing long-term dependencies. The hybrid pooling module can be understood as a feature aggregation method, combining multiple pooling operations such as max pooling and average pooling to compress the sequence output by the self-attention module. After processing by the neural network encoder and the hybrid pooling module, the trajectory embedding vector is obtained, representing a low-dimensional, dense vector of fixed dimensions for the entire trajectory.
[0069] For example, the structure of a neural network encoder is as follows: Figure 2 As shown, the neural network encoder receives the standardized clustered identifier. trajectory sequence ,right Embedding encoding is performed. The neural network encoder consists of a fully connected hidden layer, n Transformer layers, a hybrid pooling layer, and a fully connected output layer. To address the temporal continuity of the ship's trajectory, the fully connected hidden layer employs a spatiotemporally aware weight initialization strategy, expressed as:
[0070]
[0071] in The smooth initialization method based on the first-order difference of the trajectory moderately enhances the weights near the diagonal. This assumes a strong correlation between features of adjacent time steps, such as the velocity at time t and time t-1. This guides the model to focus more on the continuity and smoothness of the trajectory in the early stages of training, which aligns with the physical law that ship motion cannot change instantaneously; bias term It is initialized to tiny random values close to zero and works in conjunction with layer normalization to enable it to automatically learn the common feature baseline of ship motion during training.
[0072] In the N Transformer layers, each layer contains a multi-head self-attention mechanism and a feedforward neural network. The Transformer encoder designs a specialized self-attention mechanism for ship trajectory feature mining. Specifically, the attention heads are divided into four groups according to their functions, each focusing on a different feature subspace: path attention head, velocity attention head, heading attention head, and comprehensive attention head. For the path attention head, a query, key, and value matrix are specifically initialized, as shown below:
[0073]
[0074] in, and This is the enhancement coefficient for latitude and longitude features, preset through trajectory curvature analysis. For velocity-attention heads, a velocity bias is introduced into the attention calculation, expressed as:
[0075]
[0076] in, Here is the velocity offset coefficient. For a heading attention head, a heading change offset is introduced into the attention calculation, expressed as:
[0077]
[0078] in, represents the heading bias coefficient. For the integrated attention head, it receives the output features of all specialized attention heads from the first two Transformer layers and performs cross-dimensional correlation analysis. Its query matrix generation form can be expressed as:
[0079]
[0080]
[0081] , This indicates a feature concatenation operation. This is the output of the three special heads in the first layer. The key-value matrix generated from the output of the three specialization headers in the second layer is expressed as follows:
[0082]
[0083] in, , , , The projection matrix is learnable. Each Transformer layer employs optimized residual connections and layer normalization. Residual connections directly connect the layer's input to the output, effectively mitigating the gradient vanishing problem in deep networks and enabling the training of deeper encoders. Layer normalization standardizes the feature dimensions of each sample, stabilizing the training process and accelerating convergence. The output after processing through N Transformer encoder layers is a sequence of hidden states containing rich spatiotemporal information, represented as... ,in The time step length of the trajectory sequence. Let be the hidden state vector at time step t, containing local features and global context information at that time. In the hybrid pooling layer, attention pooling is applied to the output of the Transformer layer, as follows:
[0084]
[0085]
[0086] Perform max pooling and min pooling Then, the pieces are joined together, as shown below:
[0087] Step S302: Input the standard trajectory sequence with pseudo-labels into the neural network encoder to obtain the initial trajectory embedding representation.
[0088] It should be noted that when a standard trajectory sequence with pseudo-labels is input into an untrained neural network encoder, the resulting preliminary, unoptimized trajectory embedding vector is the initial trajectory embedding representation.
[0089] In the fully connected output layer, the concatenated hybrid pooling layer outputs are mapped to an embedding space of a specified dimension, and through the Tanh activation function and layer normalization operation, the normalized final ship trajectory embedding vector is output, represented as:
[0090] It should be noted that the neural network encoder effectively captures long-term dependencies in the trajectory sequence using its self-attention mechanism. Feature transformation is performed through specialized multi-head self-attention layers and feedforward neural network layers, outputting the hidden state at each time step. Subsequently, a hybrid pooling strategy is employed to aggregate sequence information. Specifically, attention pooling, max pooling, and min pooling are combined to generate a fixed-dimensional trajectory embedding vector, comprehensively representing the spatial structure and dynamic characteristics of the trajectory. Attention pooling is used for weighted summation based on feature importance, max pooling is used to capture salient features, and min pooling is used to retain key negative features.
[0091] Step S303: Based on the pseudo-labels, positive sample pairs and negative sample pairs are selected from the initial trajectory embedding representations. Positive sample pairs are trajectory embedding representations of the same cluster, and negative sample pairs are trajectory embedding representations of different clusters.
[0092] For example, the trajectory generated by the hybrid pooling layer can be embedded into a vector. The data is directly input into the contrastive loss function as the feature basis for supervised contrastive learning. Pseudo-labels generated by clustering are used as supervisory signals, and the encoder is trained using the supervised contrastive loss function. In the embedding space, trajectory embeddings that are closer together within the same cluster are considered positive sample pairs, while trajectory embeddings that are further apart between different clusters are considered negative sample pairs.
[0093] Step S304: Calculate the contrastive loss function based on the embedding vector similarity between positive and negative sample pairs to obtain the loss value.
[0094] It should be noted that embedding vector similarity measures how close two trajectory embedding vectors are in the representation space. The contrastive loss function is the objective function in contrastive learning, and its core idea is to reduce the similarity between positive sample pairs while increasing the similarity between negative sample pairs.
[0095] Step S305: Optimize the neural network encoder based on the loss value to obtain the target trajectory encoder.
[0096] It should be noted that the internal parameters of the neural network encoder can be adjusted using the backpropagation algorithm based on the loss value, thereby minimizing the loss function. This is similar to the iterative training process of comparative learning. Figure 3 As shown, the target trajectory encoder is a neural network encoder with stable performance obtained after optimization training using a contrastive loss function.
[0097] In this implementation, an encoder based on the Transformer architecture utilizes its multi-head self-attention module to capture long-term spatiotemporal dependencies between trajectory points, solving the forgetting problem that traditional recurrent neural networks easily encounter when processing long sequences, and achieving more accurate modeling of complex trajectory dynamics. By introducing a hybrid pooling module into the encoder, the problem of information loss or bias that may occur when aggregating variable-length sequences into fixed-dimensional vectors is solved, achieving a more comprehensive and balanced generalization of the overall trajectory features. Furthermore, pseudo-labels generated by clustering are used to construct positive and negative sample pairs, which drive contrastive learning, solving the problem of learning highly discriminative trajectory representations in the absence of real anomaly labels. This allows the model to learn unsupervised how to map similar normal behaviors to neighboring spaces and different behaviors to distant spaces. Finally, by optimizing the contrastive loss function to train the encoder, a target trajectory encoder capable of generating highly discriminative trajectory embedding vectors is obtained, laying a core foundation for subsequent reliable anomaly detection.
[0098] In one implementation, step S304 includes: calculating the embedding vector similarity between positive and negative sample pairs based on cosine similarity to obtain cosine similarity; introducing a temperature parameter to scale the cosine similarity to obtain scaled similarity, where scaling is used to control the attention given to difficult samples; and calculating a loss value based on a supervised contrastive loss function using pseudo-labels, using the scaled similarity.
[0099] For example, temperature-scaled cosine similarity is used to measure sample similarity, with the optimization objective being to make the similarity of positive sample pairs significantly higher than that of negative sample pairs. Specifically, the loss function is expressed as:
[0100]
[0101] in, This refers to the number of trajectories sampled in a single training iteration. Let be the embedding vector of the i-th trajectory. To and Trajectory embeddings belonging to the same cluster, for Trajectory embeddings belonging to different clusters To track Other trajectory index sets in the same cluster, To track Other trajectory index sets from different clusters, For cosine similarity, This refers to temperature hyperparameters.
[0102] In this implementation, cosine similarity is used to measure the similarity between embedded vectors, addressing the sensitivity of Euclidean distance and other metrics to vector magnitude. Furthermore, by introducing a temperature parameter to scale the similarity, the problem of the model over-focusing on a large number of well-distinguished simple samples under the original similarity distribution, while under-learning of difficult samples with high discrimination difficulty, is resolved. This allows for dynamic control of the model's focus on the discrimination boundary of difficult samples by adjusting the temperature coefficient, thereby learning more discriminative feature representations. By enabling the model to learn trajectory representations with intra-cluster compactness and inter-cluster separability, the model's ability to distinguish complex trajectory patterns is enhanced.
[0103] In one implementation, step S40 includes: Step S401: For each cluster, the target trajectory encoder converts all training trajectories within the current cluster into trajectory embedding vectors to obtain a set of trajectory embedding vectors.
[0104] It should be noted that training trajectories are standard trajectory sequences used for model training, while trajectory embedding vectors refer to fixed-dimensional vectors that represent the core features of a trajectory after it has been input into the target trajectory encoder. For a specific cluster, the trajectory embedding vector set represents the set of all trajectory embedding vectors obtained after all training trajectories within that cluster have been transformed by the target trajectory encoder.
[0105] Step S402: Based on the trajectory embedding vector set, calculate the mean vector and covariance matrix of the current cluster.
[0106] It should be noted that for a set of trajectory embedding vectors, the average value of each feature dimension can be calculated. Combining these average values into a vector yields the mean vector, which represents the average position of all trajectories within that cluster in the feature space. The covariance matrix is a mathematical matrix used to describe the correlation between the various feature dimensions of a set of trajectory embedding vectors and the dispersion of each dimension itself. It characterizes the distribution pattern and range of data points around the mean vector.
[0107] Step S403: For each cluster, determine the multivariate Gaussian distribution model based on the mean vector and covariance matrix to obtain multiple normal behavior pattern reference models. The multivariate Gaussian distribution model is used to represent the behavior pattern of the current cluster.
[0108] It should be noted that the multivariate Gaussian distribution model is a probabilistic statistical model based on the mean vector and covariance matrix. Assuming trajectories belonging to the same cluster have trajectory embedding vectors that follow a multivariate Gaussian distribution centered on the cluster's mean vector, with the covariance matrix describing their shape and extent. It can be understood that multiple clusters can correspond to multiple reference models of normal behavioral patterns.
[0109] For example, after model training is complete, a fine-grained reference library of normal behavior can be built for each cluster, and accurate anomaly detection can be achieved based on Mahalanobis distance. Specifically, for each cluster, its centroid vector and covariance matrix are first calculated to establish a multidimensional Gaussian distribution model. The centroid vector represents the core feature of the cluster's typical navigation pattern and is calculated as the mean of all trajectory embedding vectors within the cluster, with the corresponding formula:
[0110]
[0111] in, It is a cluster The number of trajectories, Indicates the number of elements belonging to this cluster. The embedding vector of each trajectory. The formula for calculating the covariance matrix is:
[0112]
[0113] in, Cluster The mean of the matrix is used to ensure matrix invertibility through regularization, which can adapt to the sparsity or collinearity problems that may occur in ship trajectory data.
[0114] In this embodiment, a pre-trained target trajectory encoder converts all trajectories within each normal pattern cluster into highly discriminative embedding vectors. This addresses the insufficient discriminative power when directly using raw trajectories or shallow features to construct a reference model, laying a high-quality statistical foundation for establishing an accurate reference model. Furthermore, by calculating the mean vector and covariance matrix of the trajectory embedding vectors within each cluster, the problem of using only the cluster center to describe the natural fluctuation range of normal behavior is solved. Finally, a multivariate Gaussian distribution model is constructed for each cluster based on the mean and covariance as a reference model. This achieves modeling of normal behavior from a probability density perspective, making anomaly detection no longer based on absolute distance to a single center. It allows for a more refined and statistically consistent definition of the boundary between normal and anomaly, improving the robustness and interpretability of anomaly detection.
[0115] Based on the above embodiments and implementation methods, in one implementation method, step S50 includes: Step S501: Input the new trajectory to be detected into the target trajectory encoder to generate the embedding vector to be detected.
[0116] It should be noted that the new trajectory to be detected is a newly acquired sequence of ship trajectories whose behavior needs to be determined as abnormal. After inputting the new trajectory to be detected into the target trajectory encoder, an embedding vector to be detected is generated.
[0117] Step S502: Calculate the Mahalanobis distance from the embedded vector to be detected to each normal behavior reference model, and select the minimum value from all Mahalanobis distances as the anomaly score of the new trajectory to be detected.
[0118] It's important to note that Mahalanobis distance is a metric for calculating the distance between a point and a distribution. By considering the correlations between different dimensions of the data, it can more accurately measure the probability distance of a point belonging to a multivariate Gaussian distribution. The anomaly score refers to the minimum Mahalanobis distance among all normal behavior reference models for the detected embedding vector. The anomaly score quantifies the degree of deviation between the detected trajectory and the closest normal pattern; a higher score indicates a greater likelihood of an anomaly.
[0119] Step S503: Compare the abnormal score with a preset threshold. If the abnormal score is greater than the preset threshold, the new trajectory to be detected is determined to be an abnormal behavior trajectory.
[0120] The preset threshold is derived from the statistical values of the embedding distance distribution of trajectories within each cluster during the training phase.
[0121] For example, such as Figure 4 As shown, for a newly input trajectory, the anomaly detection process first generates its embedding vector through the target trajectory encoder. Then, the Mahalanobis distance from this vector to the centroids of each normal cluster is calculated, and expressed as:
[0122] in, Let be the embedding vector to be detected. Let be the Mahalanobis distance from the embedded vector to be detected to the centroids of each normal cluster. The advantage of Mahalanobis distance is that it considers the correlation between feature dimensions and the internal distribution shape of each cluster. For example, in ship trajectories, speed and heading changes are often coupled, and Mahalanobis distance can more accurately measure this deviation. The minimum Mahalanobis distance can be taken as the anomaly score, expressed as:
[0123]
[0124] in, The minimum Mahalanobis distance ensures that a new trajectory is considered normal as long as it matches any normal pattern, thus reducing the false alarm rate. The threshold can be dynamically set according to the statistical distribution of the distances between clusters in the training set to achieve adaptive detection; for example, the 95th percentile can be used.
[0125] In this implementation, the Mahalanobis distance from the embedding vector of the detected trajectory to each normal behavior reference model is calculated during detection. This solves the problem that using Euclidean distance cannot account for the correlation between features, leading to inaccurate distance measurement. It achieves a probabilistic distance measurement based on the true distribution of data, making anomaly scoring more scientific. By selecting the minimum value from all Mahalanobis distances as the final anomaly score, it ensures that as long as the detected trajectory is close to any known normal pattern, it will not be falsely judged. Furthermore, since the preset threshold is derived from the distance distribution statistics of trajectories within each normal pattern during the training phase, it solves the problem that threshold setting relies on experience or arbitrary selection and is difficult to adapt to the inherent fluctuations of different behavior patterns. It achieves adaptive alignment between the threshold and the statistical characteristics of each normal pattern, thereby improving the sensitivity to detect real abnormal behavior while controlling the false alarm rate.
[0126] Based on the same inventive concept, such as Figure 5 As shown, this application also provides a ship abnormal behavior detection device, which includes: Data processing module 10 is used to acquire raw ship trajectory data, perform augmentation processing and hybrid standardization processing on the raw ship trajectory data, and obtain a standard trajectory sequence. The pseudo-label generation module 20 is used to generate pseudo-labels based on the standard trajectory sequence through unsupervised clustering, and the pseudo-labels are used to represent different normal navigation modes. Model training module 30 is used to train a neural network encoder by comparing the standard trajectory sequence and the pseudo-label as supervision signals to obtain the target trajectory encoder. The model building module 40 is used to build multiple normal behavior pattern reference models based on the target trajectory encoder and the trajectories in each cluster corresponding to the pseudo-label. The anomaly detection module 50 is used to input the new trajectory to be detected into the target trajectory encoder to generate the embedding vector to be detected, and to make anomaly detection based on the distance between the embedding vector to be detected and each of the normal behavior pattern reference models.
[0127] It should be noted that the ship abnormal behavior detection device provided in this application embodiment and the ship abnormal behavior detection method provided in this application embodiment are based on the same application concept. Therefore, the specific implementation of this embodiment can refer to the implementation of the aforementioned ship abnormal behavior detection method, and the repeated parts will not be described again.
[0128] An electronic device is provided in this application embodiment. The electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. The computer program is configured to implement the above-described method for detecting abnormal ship behavior.
[0129] Specifically, the processor may include, for example, a general-purpose microprocessor, an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor may also include onboard memory for caching purposes. The processor may be a single processing unit or multiple processing units for performing different actions of the method flow according to embodiments of this application.
[0130] Memory can be any medium capable of containing, storing, transmitting, propagating, or transmitting instructions. For example, memory can include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, instruments, or propagation media. Specific examples of memory include: magnetic storage devices such as magnetic tape or hard disk drives (HDDs); optical storage devices such as optical discs (CD-ROMs); and also random access memory (RAM) or flash memory; and / or wired / wireless communication links.
[0131] This application also provides a non-transitory storage medium storing a computer program that, when executed by a processor, implements the aforementioned method for detecting abnormal ship behavior. This storage medium may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not be assembled into that device / apparatus / system. The aforementioned non-transitory storage medium carries one or more programs, which, when executed, implement the method as described in the embodiments or implementations of this application.
[0132] According to embodiments of this application, a non-transitory storage medium can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. A computer-readable signal medium can also be any storage medium other than a computer-readable storage medium that can transmit, propagate, or transfer a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the storage medium can be transmitted using any suitable medium, including but not limited to: wireless, wired, optical fiber, radio frequency signals, etc., or any suitable combination thereof.
[0133] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0134] Those skilled in the art will understand that the features described in the various embodiments of this application can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this application. In particular, the features described in the various embodiments of this application can be combined and / or combined in various ways without departing from the spirit and teachings of this application. All such combinations and / or combinations fall within the scope of this application. Therefore, the scope of this application should not be limited to the above embodiments. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for detecting abnormal behavior of ships, characterized in that, The method includes: Obtain the original ship trajectory data, and perform augmentation and hybrid standardization processing on the original ship trajectory data to obtain a standard trajectory sequence; Based on the standard trajectory sequence, pseudo-labels are generated through unsupervised clustering, and the pseudo-labels are used to represent different normal navigation modes. Using the standard trajectory sequence and the pseudo-label as supervision signals, a neural network encoder is trained through contrastive learning to obtain the target trajectory encoder; Based on the target trajectory encoder, multiple normal behavior pattern reference models are constructed according to the trajectories within each cluster corresponding to the pseudo-label. The new trajectory to be detected is input into the target trajectory encoder to generate the embedding vector to be detected, and anomaly determination is made based on the distance between the embedding vector to be detected and each of the normal behavior pattern reference models.
2. The method as described in claim 1, characterized in that, The steps of acquiring raw ship trajectory data, performing augmentation and hybrid standardization on the raw ship trajectory data to obtain a standard trajectory sequence include: Obtain raw ship trajectory data, which includes static features, including time information, position information, speed information, and heading information; Based on the time information, position information, velocity information, and heading information, the acceleration and heading rate of change are calculated to obtain the dynamic characteristics; The static features and dynamic features are subjected to different standardization processes, and the trajectory points after different standardization processes are merged to obtain a standard trajectory sequence.
3. The method as described in claim 1, characterized in that, The step of generating pseudo-labels based on the standard trajectory sequence through unsupervised clustering, wherein the pseudo-labels are used to represent different normal navigation modes, includes: Global statistical features are extracted from the standard trajectory sequence to form a feature vector set; The similarity between samples in the feature vector set is calculated based on the weighted Euclidean distance to obtain the overall distance distribution of the feature vector set; The neighborhood radius parameter of the clustering algorithm is determined based on the overall distance distribution of the feature vector set; Based on the local density of the trajectory data, the minimum number of samples required to define the core points in the clustering algorithm is dynamically adjusted to obtain the adjusted minimum number of samples parameter. Density clustering is performed based on the neighborhood radius parameter of the clustering algorithm and the adjusted minimum sample number parameter. Trajectories are divided into different clusters and noise points are identified to obtain pseudo-labels.
4. The method as described in claim 1, characterized in that, The step of using the standard trajectory sequence and the pseudo-label as supervision signals to train a neural network encoder through contrastive learning to obtain the target trajectory encoder includes: A neural network encoder is built based on the Transformer architecture. The neural network encoder includes a multi-head self-attention module and a hybrid pooling module. The multi-head self-attention module is used to capture long-term spatiotemporal dependencies in the trajectory sequence. The hybrid pooling module is used to aggregate the sequence features output by the multi-head self-attention module to generate a trajectory embedding vector of fixed dimension. The multi-head self-attention module is also used to introduce a bias term based on the difference in motion state between trajectory points when calculating attention weights. The standard trajectory sequence with pseudo-labels is input into the neural network encoder to obtain an initial trajectory embedding representation; Based on the pseudo-labels, positive and negative sample pairs are selected from the initial trajectory embedding representations. The positive sample pairs are trajectory embedding representations of the same cluster, and the negative sample pairs are trajectory embedding representations of different clusters. The contrastive loss function is calculated based on the similarity of the embedding vectors of the positive and negative sample pairs to obtain the loss value; The neural network encoder is optimized based on the loss value to obtain the target trajectory encoder.
5. The method as described in claim 4, characterized in that, The step of calculating the contrastive loss function based on the embedding vector similarity of the positive and negative sample pairs to obtain the loss value further includes: The cosine similarity is calculated by measuring the embedding vector similarity between the positive and negative sample pairs. A temperature parameter is introduced to scale the cosine similarity to obtain a scaled similarity. The scaling is used to control the attention given to difficult samples. The loss value is calculated based on the scaled similarity using the supervised contrastive loss function based on the pseudo-labels.
6. The method as described in claim 1, characterized in that, The step of constructing multiple normal behavior pattern reference models based on the target trajectory encoder and the trajectories within each cluster corresponding to the pseudo-label includes: For each cluster, the target trajectory encoder converts all training trajectories within the current cluster into trajectory embedding vectors, resulting in a set of trajectory embedding vectors. Based on the set of trajectory embedding vectors, calculate the mean vector and covariance matrix of the current cluster; For each cluster, a multivariate Gaussian distribution model is determined based on the mean vector and covariance matrix to obtain multiple normal behavior pattern reference models. The multivariate Gaussian distribution model is used to represent the behavior pattern of the current cluster.
7. The method as described in claim 6, characterized in that, The step of inputting the new trajectory to be detected into the target trajectory encoder to generate the embedding vector to be detected, and determining anomalies based on the distance between the embedding vector to be detected and each of the normal behavior pattern reference models, includes: The new trajectory to be detected is input into the target trajectory encoder to generate the embedding vector to be detected; Calculate the Mahalanobis distance from the embedded vector to be detected to each normal behavior reference model, and select the minimum value from all Mahalanobis distances as the anomaly score of the new trajectory to be detected. The anomaly score is compared with a preset threshold. If the anomaly score is greater than the preset threshold, the new trajectory to be detected is determined to be an abnormal behavior trajectory. The preset threshold is derived based on the statistical value of the embedding distance distribution of trajectories within each cluster during the training phase.
8. A device for detecting abnormal ship behavior, characterized in that, The ship abnormal behavior detection device includes: The data processing module is used to acquire raw ship trajectory data, perform augmentation and hybrid standardization processing on the raw ship trajectory data, and obtain a standard trajectory sequence. A pseudo-label generation module is used to generate pseudo-labels based on the standard trajectory sequence through unsupervised clustering. The pseudo-labels are used to represent different normal navigation modes. The model training module is used to train the neural network encoder by comparing the standard trajectory sequence and the pseudo-label as supervision signals to obtain the target trajectory encoder. The model building module is used to build multiple normal behavior pattern reference models based on the target trajectory encoder and the trajectories in each cluster corresponding to the pseudo-label. The anomaly detection module is used to input the new trajectory to be detected into the target trajectory encoder to generate the embedding vector to be detected, and to make anomaly detection based on the distance between the embedding vector to be detected and each of the normal behavior pattern reference models.
9. An electronic device, characterized in that, The electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the ship abnormal behavior detection method as described in any one of claims 1 to 7.
10. A non-transitory storage medium, characterized in that, The non-transient storage medium stores a computer program, which, when executed by a processor, implements the steps of the ship abnormal behavior detection method as described in any one of claims 1 to 7.
Citation Information
Cited By
Ship platform abnormal behavior detection method based on ADS-B big data
CN121923940A