An AIS data-based large model ship abnormal behavior prediction and entity classification method and system

By cleaning and subsampling AIS data using multiple strategies, combined with multi-scale analysis and multi-task loss functions of deep learning models, the problems of inconsistent AIS data quality and class imbalance were solved, enabling highly sensitive identification and real-time monitoring of abnormal ship behavior.

CN122432853APending Publication Date: 2026-07-21NANJING LES CYBERSECURITY & INFORMATION TECH RES INST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NANJING LES CYBERSECURITY & INFORMATION TECH RES INST CO LTD
Filing Date
2026-03-12
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

The quality of existing AIS data varies, the time interval between trajectory points is not fixed, and there is a lot of noise, making it difficult for conventional sequence models to capture effective features. Furthermore, abnormal behavior samples are scarce in massive amounts of data, and class imbalance makes model training difficult, making it difficult to handle local mutations and global patterns, and it is easy to confuse stationary objects with moored ships.

Method used

Through data cleaning and analysis, a multi-strategy subsampling and deep learning model is constructed. Local, global, and spatiotemporal scale analysis branches are adopted, and multi-task loss functions and multi-head self-attention mechanisms are combined to extract multi-dimensional features. Entities and activities are classified through information fusion and residual connections.

Benefits of technology

It achieves highly sensitive identification of abnormal ship behavior, improves the accuracy of entity recognition, adapts to online AIS data streams, meets real-time monitoring needs, solves the problems of class imbalance and loss of key features, and improves the model's understanding of behavior under complex sea conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122432853A_ABST
    Figure CN122432853A_ABST
Patent Text Reader

Abstract

The application discloses a ship abnormal behavior detection method based on a large model, comprising the following steps: accessing an AIS data stream, cleaning and analyzing the AIS data, extracting ship static information and dynamic trajectory information, and generating a ship type label. The entity data set is filtered and screened to generate labeled data containing ships, and an end activity prediction data set is constructed. According to the preset sampling requirement, the end activity prediction data set is processed by using multiple seed sampling strategies to obtain a training sample set. The processed training sample set is input into a deep learning model, and features are extracted by a multi-scale analysis module inside the model. The extracted trajectory features and ship type features are fused, a variable-length trajectory sequence is processed by using a mask mechanism, and original key information is reserved by using residual connection. Based on the fused features, the model outputs entity classification results and activity classification results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence prediction technology for ship navigation behavior, and in particular to a method and system for monitoring abnormal ship behavior based on a large model. Background Technology

[0002] When ships are sailing in the open sea, the ship's AIS equipment will report hundreds of types of transmissions, and the business system will receive massive amounts of AIS data. The overall situation is very complex, and the business needs to distinguish between "fishing", "berthing" and "navigation" behaviors with the lowest possible latency.

[0003] The quality of existing AIS (Automatic Identification System) data varies, the time intervals between trajectory points are not fixed, and there is a lot of noise, making it difficult for conventional sequence models to capture effective features.

[0004] In the massive AIS data, normal navigation data accounts for the vast majority, while samples of abnormal behavior (such as smuggling and illegal fishing) are extremely scarce. This severe class imbalance makes model training difficult.

[0005] Existing models struggle to handle both local mutations (such as sharp turns) and global patterns (such as long-distance routes) simultaneously, and often confuse stationary objects (stationary landmarks, fishing nets, etc.) with moored vessels (stationary ships). Summary of the Invention

[0006] To address the shortcomings of existing technologies, this invention proposes a method for predicting abnormal ship behavior and classifying entities based on large-scale AIS data, comprising the following steps:

[0007] Step 1, Data Access and Preprocessing: Access the Automatic Identification System (AIS) data stream, clean and parse the AIS data, extract static and dynamic trajectory information of the vessel, extract the unique identifier (Trajectory ID) for each trajectory, and generate a vessel type label;

[0008] Step 2, Dataset Construction and Labeling: Filter and select the entity dataset to generate ship labeling data and construct the terminal activity prediction dataset;

[0009] Step 3, Multi-strategy subsampling: According to the preset sampling requirements, multiple subsampling strategies are used to process the terminal activity prediction dataset to obtain a training sample set;

[0010] Step 4, Deep Learning Model Training: Input the processed training sample set into the deep learning model to construct a deep learning model containing local scale analysis branches, global scale analysis branches, and spatiotemporal scale analysis branches; input the processed training sample set into the deep learning model for forward propagation to extract multidimensional features of ship behavior at local time scales, global time scales, and spatiotemporal scales, and output prediction results; calculate the multi-task loss function value based on the prediction results and the true labels; calculate the gradient using the backpropagation algorithm, and iteratively update the network parameters of the deep learning model according to the optimization strategy until the model converges or reaches the preset number of training rounds;

[0011] Step 5, Multi-scale feature extraction: Input the training sample set into the deep learning model, and extract multi-dimensional features of ship behavior at local time scale, global time scale, and spatiotemporal scale through the model;

[0012] Step 6, Information Fusion and Processing: The trajectory features extracted in Step 5 are fused with the ship type features generated in Step 1. The variable-length trajectory sequence is processed based on the masking mechanism, and the original key information is preserved through residual connection.

[0013] Step 7, Multi-task prediction output: Based on the fused features, the model outputs entity classification results and activity classification results; the entity classification is used to identify whether the trajectory subject is a ship, and the activity classification is used to identify the specific behavior type of the ship.

[0014] In some embodiments, the data cleaning and parsing in step 1 specifically includes the following sub-steps:

[0015] Step 1-1, Abnormal data cleaning: Remove noisy data from AIS data where the speed exceeds the preset threshold or the latitude and longitude coordinates are out of bounds;

[0016] Steps 1-2, Tagging System Construction: Based on the ship's MMSI number and historical behavior database, ship entities are marked as "merchant ships", "fishing vessels", "law enforcement vessels" or "stationary objects";

[0017] Steps 1-3, Static Object Sample Processing: Generate a special negative sample set for "static objects" to prevent the model from misidentifying them as abnormally stationary ships.

[0018] In some embodiments, the multiple subsampling strategies in step 3 include at least one of the following:

[0019] Strategy 1: Random proportional sampling, randomly selecting a set proportion of samples from the terminal activity prediction dataset;

[0020] Strategy 2: Sparsification sampling within the trajectory; For a single trajectory with an excessively high sampling frequency, based on the trajectory ID, redundant points in the middle of the trajectory are removed according to a preset time interval or random ratio while retaining the first and last nodes (i.e., only "sparsening" is done, not "truncating").

[0021] Strategy 3: Integrity sampling based on trajectory ID; For tasks that need to retain long-term temporal dependency features, randomly select a portion of trajectory IDs and retain all temporal data points corresponding to the selected trajectory IDs (i.e., retain the entire line without scattering).

[0022] Strategy 4: Based on sampling in the middle of the activity, for each continuous activity of the same type, extract sample points located at 25%, 50%, and 75% of the time in that activity segment.

[0023] Strategy 5: Sampling based on activity boundaries. For each consecutive segment of the same type of activity, extract the starting point and ending point of that segment.

[0024] The system automatically selects a combination of strategies based on the statistical characteristics of the input dataset:

[0025] Scenario A (Extremely Imbalanced Data): When the ratio of positive to negative samples is lower than the threshold (e.g., 1:100), the system will first activate Strategy 1 (random proportional balancing sampling) to force the sample distribution to be flattened.

[0026] Scenario B (High-frequency redundant data): When the AIS data transmission frequency is higher than the threshold (e.g., one data transmission every 2 seconds), resulting in an excessively long sequence, in order to adapt to the model input length limit, the system uses Strategy 2 (sparse sampling within the trajectory) to reduce the amount of data without destroying the trajectory shape.

[0027] Scenario C (Long-term pattern recognition): When the task objective is to identify complex operation patterns (such as trawling), in order to prevent the disruption of time dependencies, the system disables Strategy 1 and instead uses Strategy 3 (integrity sampling based on trajectory ID) to ensure that the input model is the complete operation cycle.

[0028] Combined application: The above strategies can be executed sequentially. For example, first execute strategy three to select 1000 trajectories, and then execute strategy four to extract key points from these 1000 trajectories, thereby reducing the amount of computation while retaining core features.

[0029] In some embodiments, step 4, training the deep learning model, specifically includes the following steps:

[0030] Step 4-1: Construct a deep learning model with three scale branches: local, global, and spatiotemporal. Input the training samples into the model for forward propagation, extract multidimensional features of ship behavior, and output the prediction results.

[0031] Step 4-2, calculate the entity classification loss. The binary cross-entropy loss function is used to calculate the loss based on the predicted entity probability output by the model and the actual entity label, in order to optimize the model's ability to distinguish between ships and stationary objects.

[0032]

[0033] in For real entity labels (0 for stationary objects, 1 for ships). The predicted probability of the model;

[0034] Step 4-3, calculate the activity classification loss. The multi-class cross-entropy loss function is used to calculate the loss based on the predicted activity probability distribution output by the model and the actual activity labels, in order to optimize the model's ability to identify specific ship behavior types.

[0035]

[0036] in Total number of activity categories (in this embodiment) ), True labels for one-hot encoding;

[0037] Step 4-4, Construct the total loss function: The entity classification loss, activity classification loss, and regularization term are weighted and summed to form the model's total loss function. :

[0038]

[0039] in For hyperparameters, For L2 regularization terms;

[0040] (Entity classification weight): The value range is... Since entity classification (ships / buoys) is a binary classification task with relatively obvious features and a fast convergence speed, it is assigned a low weight. (Activity category weight): The value range is... Since activity classification involves multiple complex dynamic behavior patterns and is a multi-classification task, it is quite difficult to train. Therefore, it is assigned a high weight to dominate the direction of gradient update.

[0041] (Regularization coefficient): The range of values ​​is... This term is used to constrain the L2 norm of the network weights to prevent overfitting caused by excessively large weights.

[0042] Steps 4-5: Optimize model parameters: Based on the total loss function constructed above. This step uses the backpropagation algorithm combined with an adaptive moment estimation optimizer to iteratively update the network parameters of the deep learning model. The specific process is as follows:

[0043] Gradient calculation: Using the chain rule, calculate the total loss function. For each trainable parameter in the model The partial derivatives (including CNN convolutional kernel weights, Transformer attention matrices, fully connected layer biases, etc.) of the gradient. :

[0044]

[0045] First and Second Moment Estimation: Calculate the exponentially weighted moving average of the gradient using the Adam optimizer. Calculate the first moment estimate. (Mean of gradient) and second moment estimation (Uncentered variance of the gradient):

[0046] in, This represents the current iteration round number. Attenuation rate (preferred) Parameter update: Based on the calculated moment estimates, update the network parameters according to the following formula. :

[0047]

[0048] in, This refers to the learning rate. To prevent smooth terms with a denominator of zero.

[0049] Steps 4-6, Iteration Termination: Repeat the above steps of forward propagation to calculate loss, backpropagation to calculate gradient, and parameter update until the total loss function is calculated. When the model converges to below a preset threshold or reaches the preset maximum number of training epochs, the model training is considered complete and parameter optimization is finished.

[0050] In some embodiments, the parameters in step 4-4 Less than .

[0051] In some embodiments, the multi-scale feature extraction in step 5 specifically includes:

[0052] Convolutional Neural Networks (CNNs) capture local dependencies between adjacent time steps through convolutional operations to extract local scale features for recognizing short-term behaviors, including but not limited to acceleration, deceleration, or turning behaviors.

[0053] Based on the Transformer network, a self-attention mechanism is used to capture long-distance temporal dependencies in order to extract global-scale features that identify complete navigation or operational patterns.

[0054] The Conditional Position Encoding (CPE) module generates dynamic position codes by combining the spatial coordinates and timestamps of trajectory data, thereby enhancing the spatiotemporal perception capability for extracting spatiotemporal scale features.

[0055] In some embodiments, the multi-scale feature extraction in step 5 specifically includes the following steps:

[0056] Step 5-1, Input Vector Construction: Represent each AIS trajectory sequence as a set containing T time steps, and define the input feature vector for each time step as follows: The input feature vector at each time step Defined as:

[0057]

[0058] in, This represents the normalized values ​​of latitude and longitude coordinates. For ground speed, For ground heading, This represents the time interval between the current point and the previous point.

[0059] Step 5-2, Conditional Position Encoding Generation: Based on the Conditional Position Encoding Generator (CPEG), for the first position in the sequence... Each point has a position embedding vector. :

[0060]

[0061] in, This is the absolute timestamp of that point. These are the sine / cosine position encoding functions, respectively. This represents a vector concatenation operation. For multilayer perceptron mapping, spatiotemporal physical information is mapped to the hidden layer dimension of the model. Consistent feature space;

[0062] The resulting vector sequence is a superposition of the original feature embeddings and the location embeddings.

[0063]

[0064] Step 5-3, Local Scale Feature Extraction: Local behavioral features are extracted using a one-dimensional convolutional neural network (CNN) to obtain the local features at the i-th time step. :

[0065]

[0066] in, convolution kernel For bias terms, The kernel size is [size]. This is the ReLU activation function.

[0067] Step 5-4, Global Scale Feature Extraction: Using the multi-head self-attention mechanism of the Transformer network, the input... The mapping is to a query matrix Q, a key matrix K, and a value matrix V.

[0068]

[0069] Calculate the attention weights and sum them by weight to obtain the global features. :

[0070]

[0071] in Scaling factor Given a mask matrix, for the filling positions ,set up ,otherwise ;

[0072] In some embodiments, the information fusion and processing in step 6 specifically includes:

[0073] Local features With global features and ship static type embedding The fusion process is performed, and residual connections are introduced to obtain the fusion features. :

[0074]

[0075] in To output the projection matrix, This is a layer normalization operation.

[0076] A ship abnormal behavior prediction and entity classification system based on AIS data includes:

[0077] The data processing module is used to access the Automatic Identification System (AIS) data stream, clean and parse the AIS data, extract static and dynamic trajectory information of the ship, and generate ship type labels.

[0078] The dataset construction and annotation module is used to filter and select entity datasets, generate labeled data containing ships, and build datasets for end-point activity prediction.

[0079] The multi-strategy sampling module is used to process the terminal activity prediction dataset using multiple sub-sampling strategies according to preset sampling requirements to obtain a training sample set;

[0080] The multi-scale feature extraction module is used to input the processed training sample set into the deep learning model to extract multi-dimensional features of ship behavior at local time scale, global time scale, and spatiotemporal scale.

[0081] The information fusion processing module is used to fuse the extracted multidimensional features with the ship type features, process the variable-length trajectory sequence using a masking mechanism, retain the original key information through residual connection, and output the fused enhanced features.

[0082] The multi-task prediction output module is used to simultaneously output entity classification results and activity classification results based on the fused enhanced features.

[0083] Compared with the prior art, the beneficial effects of the present invention are:

[0084] 1. Solves the problems of class imbalance and loss of key features: By introducing specific subsampling strategies such as "mid-activity" and "activity boundary", this invention not only balances the number of samples, but also forces the model to pay attention to key features of behavior that change abruptly (such as start and end times) and behavior that is stable (such as the middle of the operation), which significantly improves the sensitivity to abnormal behavior.

[0085] 2. Achieved comprehensive perception across multiple scales: Combining the advantages of CNN in extracting local features (such as instantaneous velocity changes) and Transformer in extracting long-distance dependencies (such as periodic reciprocating motion), and with CPE to process AIS data with non-uniform time intervals, the model has a more thorough understanding of ship behavior under complex sea conditions.

[0086] 3. Improved the accuracy of entity recognition: A dedicated entity classification task was introduced, which effectively solved the problem that traditional methods easily misclassify stationary objects on the sea surface as stationary ships, thus generating false warnings.

[0087] 4. Possesses efficient real-time processing capabilities: Through masking and optimized model structure, it can adapt to online AIS data streams and meet regulatory requirements for real-time performance. Attached Figure Description

[0088] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments, and the advantages of the present invention in the above and / or other aspects will become clearer.

[0089] Figure 1 This is the system flowchart for this solution.

[0090] Figure 2 This is a diagram of the model architecture of this solution. Detailed Implementation

[0091] Step 1: Overall Process and Data Processing

[0092] like Figure 1-2 As shown, this invention first accesses the raw AIS packets through a data interface. Due to packet loss and drift in AIS data, it is first cleaned to remove noise points with abnormal speeds (such as exceeding 50 segments) or out-of-bounds coordinates.

[0093] Step 2, Dataset Construction and Labeling:

[0094] The tagging system is then constructed. Based on the MMSI number range and historical behavior database, the system labels targets as "merchant ships," "fishing vessels," "law enforcement vessels," or "stationary objects." In particular, for "stationary objects," a non-moving entity, the system generates a special negative sample set to prevent the model from misidentifying it as a "ship that is abnormally stationary."

[0095] Step 3: Multi-strategy subsampling mechanism

[0096] After obtaining the cleaned trajectory data, this embodiment employs a combined sampling module to enable the large model to learn more efficiently. The specific operation is as follows:

[0097] Basic balancing strategy: For normal straight-line navigation data (majority class) and abnormal wandering data (minority class), random proportional sampling is used. For example, the ratio of positive to negative samples is set to 1:3, and excess normal samples are removed to ensure that the model is not biased in predicting "normal".

[0098] Trajectory integrity preservation strategy: To enable the model to learn "from start to finish" navigation logic, the system performs sampling based on trajectory IDs. The MMSI of a randomly selected ship is retained, and all data points for that voyage are preserved without truncation. This helps the Transformer module learn long sequence patterns.

[0099] Key feature enhancement strategies:

[0100] Focusing on the middle of the activity: For a continuous "trawling operation" activity, the system automatically locates sample points at 25%, 50%, and 75% of that time period. These points represent the most typical state of the behavior, helping the model quickly establish behavioral benchmarks.

[0101] Focus on activity boundaries: For behavior transition moments (e.g., from "sailing" to "anchoring"), the system forcibly extracts the start and end points of that activity segment. Experiments show that abnormal behavior is often accompanied by frequent start and end point transitions, and this strategy significantly improves the recall rate of anomaly detection.

[0102] Step 4: Training the Medium-Deep Learning Model

[0103] To achieve both "entity classification" and "activity classification" simultaneously, this invention designs a weighted multi-task loss function.

[0104] Let the total loss function of the model be Its definition is as follows:

[0105]

[0106] The specific definitions of each part are as follows:

[0107] 1. Entity classification loss ( )

[0108] To distinguish between ships and stationary objects, a binary cross-entropy loss function is used:

[0109]

[0110] in For real entity labels (0 for stationary objects, 1 for ships). This represents the predicted probability of the model.

[0111] 2. Activity Classification Loss ( )

[0112] To identify specific ship behaviors (such as navigation, anchoring, fishing), a multi-class cross-entropy loss function is used:

[0113]

[0114] in Total number of activity categories (in this example) ), The true label for one-hot encoding.

[0115] 3. Weight Adjustment

[0116] This is a hyperparameter used to balance the weights of the two tasks. In a preferred embodiment of the invention, since abnormal activity identification is more difficult, it is set to... ( This encourages the model to focus more on learning activity features. This is the L2 regularization term, used to prevent the model from overfitting. .

[0117] Optimize model parameters

[0118] The total loss function constructed above This step uses the backpropagation algorithm combined with an adaptive moment estimation optimizer to iteratively update the network parameters of the deep learning model. The specific process is as follows:

[0119] Gradient calculation: Using the chain rule, calculate the total loss function. For each trainable parameter in the model The partial derivatives (including CNN convolutional kernel weights, Transformer attention matrices, fully connected layer biases, etc.) of the gradient. :

[0120]

[0121] First and Second Moment Estimation: Calculate the exponentially weighted moving average of the gradient using the Adam optimizer. Calculate the first moment estimate. (Mean of gradient) and second moment estimation (Uncentered variance of the gradient):

[0122] in, This represents the current iteration round number. The attenuation rate (take) Parameter update: Based on the calculated moment estimates, update the network parameters according to the following formula. :

[0123]

[0124] in, This refers to the learning rate. To prevent smoothing terms with a denominator of zero, the iteration terminates by repeating the forward propagation to calculate the loss, the backpropagation to calculate the gradient, and the parameter update steps until the total loss function is reached. When the model converges to below a preset threshold or reaches the preset maximum number of training epochs, the model training is considered complete and parameter optimization is finished.

[0125] Step 5: Mathematical Expression of Multi-Scale Model Architecture

[0126] In this embodiment, the deep neural network's processing of AIS data can be rigorously defined using the following mathematical model:

[0127] Step 5-1, Input Vector Representation

[0128] Let an AIS trajectory sequence be... ,Include Each time step, i.e. The input feature vector at each time step. Defined as:

[0129]

[0130] in, This represents the normalized values ​​of latitude and longitude coordinates. For ground speed, For ground heading, This represents the time interval between the current point and the previous point.

[0131] Step 5-2, Conditional Position Encoding (CPE) Algorithm

[0132] To address the loss of spatiotemporal features due to non-uniform temporal sampling of AIS data, this invention does not use fixed position indices but instead employs a Conditional Position Encoding Generator (CPEG). For the first position in the sequence... Each point has a position embedding vector. The calculation formula is as follows:

[0133]

[0134] in, This is the absolute timestamp of that point. These are the sine / cosine position encoding functions, respectively. This represents a vector concatenation operation. For multilayer perceptron mapping, spatiotemporal physical information is mapped to the hidden layer dimension of the model. Consistent feature space;

[0135] The final vector sequence input into the model This is a superposition of the original feature embedding and the location embedding:

[0136]

[0137] Local and global feature extraction

[0138] The model is divided into parallel local branches and global branches:

[0139] Step 5-3, Local Scale (CNN Branches):

[0140] One-dimensional convolution operations are used to extract local behavioral features. Let the convolution kernel be... , bias is Then the local features at the $i$-th time step The calculation is as follows:

[0141]

[0142] in, The kernel size (preferred in this embodiment) ), This is the ReLU activation function.

[0143] Step 5-4, Global Scale (Transformer Branch):

[0144] A multi-head self-attention mechanism is employed. First, the input... Mapped to query matrix Key matrix Sum matrix :

[0145]

[0146] Then, the attention weights are calculated and summed to obtain the global features. :

[0147]

[0148] in:

[0149] in Scaling factor Given a mask matrix, for the filling positions ,set up ,otherwise This step ensures the accuracy of variable-length AIS trajectories during batch processing.

[0150] Step 6: Feature Fusion and Residual Connection

[0151] Local features With global features and ship static type embedding The fusion process is performed. To preserve the original information, residual connections are introduced:

[0152]

[0153] in To output the projection matrix, This is a layer normalization operation.

[0154] Step 7: Multi-task prediction output: Based on the fused features, the model outputs entity classification results and activity classification results; the entity classification is used to identify whether the trajectory subject is a ship, and the activity classification is used to identify the specific behavior type of the ship.

[0155] This invention provides a method and system for predicting abnormal ship behavior and classifying entities based on AIS data in a large model. Many methods and approaches exist for implementing this technical solution; the above description is merely a preferred embodiment. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this invention, and these improvements and modifications should also be considered within the scope of protection of this invention. All components not explicitly stated in this embodiment can be implemented using existing technologies.

Claims

1. A method for predicting abnormal ship behavior and classifying entities based on AIS data in a large model, characterized in that, Includes the following steps: Step 1, Data Access and Preprocessing: Access the Automatic Identification System (AIS) data stream, clean and parse the AIS data, extract static and dynamic trajectory information of the ship, extract the unique identifier of each trajectory, and generate a ship type label; Step 2, Dataset Construction and Labeling: Filter and select the entity dataset to generate ship labeling data and construct the terminal activity prediction dataset; Step 3, Multi-strategy subsampling: According to the preset sampling requirements, multiple subsampling strategies are used to process the terminal activity prediction dataset to obtain a training sample set; Step 4, Deep learning model training: Using the training sample set generated in step 3, train a deep learning model that includes local, global and spatiotemporal scale branches. Optimize entity and activity classification through multi-task learning, enabling it to extract multi-dimensional behavioral features of ships. Step 5, Multi-scale feature extraction: Input the training sample set into the deep learning model, and extract multi-dimensional features of ship behavior at local time scale, global time scale, and spatiotemporal scale through the model; Step 6, Information Fusion and Processing: The trajectory features extracted in Step 5 are fused with the ship type features generated in Step 1. The variable-length trajectory sequence is processed based on the masking mechanism, and the original key information is preserved through residual connection. Step 7, Multi-task prediction output: Based on the fused features, the model outputs entity classification results and activity classification results; the entity classification is used to identify whether the trajectory subject is a ship, and the activity classification is used to identify the specific behavior type of the ship.

2. The method according to claim 1, characterized in that, The data cleaning and parsing in step 1 specifically includes the following sub-steps: Step 1-1, Abnormal data cleaning: Remove noisy data from AIS data where the speed exceeds the preset threshold or the latitude and longitude coordinates are out of bounds; Steps 1-2, Tagging System Construction: Based on the vessel's MMSI number and historical behavior database, mark the vessel entity as "merchant ship", "fishing vessel", "law enforcement vessel" or "stationary object"; Steps 1-3, Static Object Sample Processing: Generate a special negative sample set for "static objects" to prevent the model from misidentifying them as abnormally stationary ships.

3. The method according to claim 1, characterized in that, The multiple subsampling strategies in step 3 include at least one of the following: Strategy 1: Random proportional sampling, randomly selecting a set proportion of samples from the terminal activity prediction dataset; Strategy 2: Sparsity sampling within the trajectory; For a single trajectory with an excessively high sampling frequency, based on the trajectory ID, redundant points in the middle of the trajectory are removed according to a preset time interval or a random ratio while retaining the first and last nodes. Strategy 3: Integrity sampling based on trajectory ID; For tasks that require the retention of long-term temporal dependency features, a subset of trajectory IDs are randomly selected, and all temporal data points corresponding to the selected trajectory IDs are retained. Strategy 4: Based on sampling in the middle of the activity, for each consecutive activity of the same type, extract sample points located at 25%, 50%, and 75% of the time in that activity segment. Strategy 5: Sampling based on activity boundaries. For each continuous segment of the same type of activity, extract the starting point and ending point of that segment.

4. The method according to claim 3, characterized in that, The system automatically selects a combination of strategies based on the statistical characteristics of the input dataset, specifically: Scenario A, i.e., extremely imbalanced data: when the ratio of positive to negative samples is lower than the threshold, the system will first activate strategy one to force the sample distribution to be leveled. Scenario B, i.e., high-frequency redundant data: When the AIS data transmission frequency exceeds the threshold, resulting in an excessively long sequence, the system uses Strategy 2 to reduce the amount of data without disrupting the trajectory shape. Scenario C, namely long time-series pattern recognition: When the task objective is to identify complex job patterns, in order to prevent the time dependencies from being broken, the system disables strategy one and uses strategy three instead, ensuring that the input model is a complete job cycle. The above strategies can be executed sequentially as needed.

5. The method according to claim 1, characterized in that, Step 4, the deep learning model training, specifically includes the following steps: Step 4-1: Construct a deep learning model with three scale branches: local, global, and spatiotemporal. Input the training samples into the model for forward propagation, extract multidimensional features of ship behavior, and output the prediction results. Step 4-2: Calculate the entity classification loss. The binary cross-entropy loss function is used to calculate the loss based on the predicted entity probability output by the model and the actual entity label, in order to optimize the model's ability to distinguish between ships and stationary objects. in For real entity labels (0 for stationary objects, 1 for ships). The predicted probability of the model; Step 4-3, calculate the activity classification loss. The multi-class cross-entropy loss function is used to calculate the loss based on the predicted activity probability distribution output by the model and the actual activity labels, in order to optimize the model's ability to identify specific ship behavior types. in Total number of activity categories (in this example) ), True labels for one-hot encoding; Step 4-4, Construct the total loss function: The entity classification loss, activity classification loss, and regularization term are weighted and summed to form the model's total loss function. : in For hyperparameters, For L2 regularization terms; Entity classification weights: The value range is... ; Activity category weights: Value range is... ; Regularization coefficient: Its value range is... ; Steps 4-5: Optimize model parameters: Based on the total loss function constructed above. This step uses the backpropagation algorithm combined with an adaptive moment estimation optimizer to iteratively update the network parameters of the deep learning model. The specific process is as follows: Gradient calculation: Using the chain rule, calculate the total loss function. For each trainable parameter in the model The partial derivative, i.e., the gradient. : First and Second Moment Estimation: First-order moment estimates are calculated by using the Adam optimizer to compute the exponentially weighted moving average of the gradient. That is, the mean and second moment estimation of the gradient. , Let be the mean of the gradient. The uncentered variance of the gradient: in, This represents the current iteration round number. Attenuation rate Parameter Update: Based on the calculated moment estimates, update the network parameters according to the following formula. : in, For learning rate, To prevent smooth terms with a denominator of zero; Steps 4-6, Iteration Termination: Repeat the above steps of forward propagation to calculate loss, backpropagation to calculate gradient, and parameter update until the total loss function is calculated. When the model converges to below a preset threshold or reaches the preset maximum number of training rounds, the model training is considered complete and parameter optimization ends.

6. The method according to claim 5, characterized in that, Parameters in step 4-4 Less than .

7. The method according to claim 1, characterized in that, The multi-scale feature extraction in step 5 specifically includes: Convolutional Neural Networks (CNNs) capture local dependencies between adjacent time steps through convolutional operations to extract local scale features for recognizing short-term behaviors, including but not limited to acceleration, deceleration, or turning behaviors. Based on the Transformer network, a self-attention mechanism is used to capture long-distance temporal dependencies in order to extract global-scale features that identify complete navigation or operational patterns. The Conditional Position Encoding (CPE) module generates dynamic position codes by combining spatial coordinates and timestamps from trajectory data, thereby enhancing the spatiotemporal perception capability for extracting spatiotemporal scale features.

8. The method according to claim 7, characterized in that, Step 5, the multi-scale feature extraction, specifically includes the following steps: Step 5-1, Input Vector Construction: Represent each AIS trajectory sequence as a set containing T time steps, and define the input feature vector for each time step as follows: The input feature vector at each time step Defined as: in, This represents the normalized values ​​of latitude and longitude coordinates. For ground speed, For ground heading, This represents the time interval between the current point and the previous point. Step 5-2, Conditional Position Encoding Generation: Based on the Conditional Position Encoding Generator (CPEG), for the first position in the sequence... Each point has a position embedding vector. : in, This is the absolute timestamp of that point. These are the sine / cosine position encoding functions, respectively. This represents a vector concatenation operation. For multilayer perceptron mapping, spatiotemporal physical information is mapped to the hidden layer dimension of the model. Consistent feature space; The resulting vector sequence is a superposition of the original feature embeddings and the location embeddings. Step 5-3, Local Scale Feature Extraction: Local behavioral features are extracted using a one-dimensional convolutional neural network (CNN) to obtain the local features at the i-th time step. : in, convolution kernel For bias terms, The kernel size is [size]. This is the ReLU activation function. Step 5-4, Global Scale Feature Extraction: Using the multi-head self-attention mechanism of the Transformer network, the input... The mapping is to a query matrix Q, a key matrix K, and a value matrix V. Calculate the attention weights and sum them by weight to obtain the global features. : in Scaling factor Given a mask matrix, for the filling positions ,set up ,otherwise .

9. The method according to claim 8, characterized in that, The information fusion and processing in step 6 specifically includes: Local features With global features and ship static type embedding The fusion process is performed, and residual connections are introduced to obtain the fusion features. : in To output the projection matrix, This is a layer normalization operation.

10. A large-scale ship abnormal behavior prediction and entity classification system based on AIS data, wherein any one of the methods in claims 1-9 is used for ship abnormal behavior prediction and entity classification, characterized in that, include: The data processing module is used to access the Automatic Identification System (AIS) data stream, clean and parse the AIS data, extract static and dynamic trajectory information of the ship, and generate ship type labels. The dataset construction and annotation module is used to filter and select entity datasets, generate labeled data containing ships, and build datasets for end-point activity prediction. The multi-strategy sampling module is used to process the terminal activity prediction dataset using multiple sub-sampling strategies according to preset sampling requirements to obtain a training sample set; The multi-scale feature extraction module is used to input the processed training sample set into the deep learning model to extract multi-dimensional features of ship behavior at local time scale, global time scale, and spatiotemporal scale. The information fusion processing module is used to fuse the extracted multidimensional features with the ship type features, process the variable-length trajectory sequence using a masking mechanism, retain the original key information through residual connection, and output the fused enhanced features. The multi-task prediction output module is used to simultaneously output entity classification results and activity classification results based on the fused enhanced features.