Ship trajectory classification method and system based on multi-scale convolution and BiLSTM
By combining the multi-scale convolution and BiLSTM methods with AIS data preprocessing, a trajectory segmentation and classification model was constructed, which solved the problems of ship trajectory data complexity and high-dimensional coupling characteristics, and achieved efficient trajectory classification and accurate trajectory segmentation.
Patent Information
- Application Number
- CN202510713770.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-09-05
AI Technical Summary
Existing technologies find it difficult to effectively handle the complexity and high-dimensional coupling characteristics of ship trajectory data, resulting in low accuracy in ship trajectory classification. Traditional methods consume a lot of manpower and find it difficult to capture global behavior patterns.
Using the multi-scale convolution and BiLSTM method, a trajectory segmentation model based on multi-scale convolution and convolution attention modules and a trajectory classification model based on BiLSTM and attention mechanism are constructed. Combined with AIS data preprocessing, the trajectory feature vector matrix is extracted, and the trajectory segmentation results are generated and classified.
The accuracy and efficiency of ship trajectory classification are improved. Multi-scale convolution is used to capture local and global features, suppress noise interference, dynamically adjust feature weights, enhance the robustness of feature representation, and solve the problems of trajectory segmentation error and redundant segmentation in traditional methods.
Smart Images

Figure CN120597034A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of ships, and in particular to a ship trajectory classification method and system based on multi-scale convolution and BiLSTM. Background Art
[0002] With the increasing adoption of Automatic Identification System (AIS) equipment on various types of ships, the ship trajectory information recorded by it has become a valuable spatiotemporal data resource. This trajectory data contains a wealth of information about ship motion, and its analysis and mining are crucial for maritime traffic management, navigation safety, and marine pollution monitoring. However, these analyses and mining tasks require supporting fundamental algorithms. Trajectory data classification and recognition is one of these fundamental algorithms. In the field of ship navigation, trajectories in typical scenarios often exhibit highly complex coupled characteristics. A complete ship trajectory is typically composed of a variety of dynamic navigation behaviors, such as straight-line navigation, turning maneuvers, and circular maneuvers. In these scenarios, relying solely on manual methods to classify ship trajectories into specific categories would not only result in a massive workload but also in significant human resource consumption and waste. Therefore, specialized trajectory classification methods are needed to identify different types of ship trajectories.
[0003] Existing technologies face challenges in accurately classifying historical ship trajectories due to the sheer size of the data, the high-order coupling of feature dimensions, and the complex disturbances of dynamic environmental factors. Specifically, long sequences of ship trajectories exhibit a typical cascade of multi-stage behavioral segments, including typical states such as straight-line navigation, dynamic steering, and anchored stationary. The characteristic variability between behavioral segments and the sparsity of state transitions make it difficult for traditional classification models to capture global behavioral patterns, resulting in a dual dilemma of state space explosion and behavioral pattern fragmentation.
[0004] Therefore, it is necessary to provide a ship trajectory classification method and system based on multi-scale convolution and BiLSTM to improve the accuracy of ship trajectory classification. Summary of the Invention
[0005] The present invention provides a ship trajectory classification method based on multi-scale convolution and BiLSTM, comprising: constructing a trajectory segmentation model of multi-scale convolution and convolution attention modules; constructing a trajectory classification model based on BiLSTM and attention mechanism; acquiring AIS data, preprocessing the AIS data, and extracting a trajectory feature vector matrix; generating a trajectory segmentation result according to the trajectory feature vector matrix through the trajectory segmentation model of multi-scale convolution and convolution attention modules; and performing trajectory classification according to the trajectory segmentation result through the trajectory classification model based on BiLSTM and attention mechanism.
[0006] Furthermore, the AIS data is preprocessed to extract the trajectory feature vector matrix, including: performing position outlier processing and speed outlier processing on the AIS data to generate an original feature vector; generating a navigation distance feature supplement vector based on the latitude and longitude feature vectors of the original feature vector, and splicing the navigation distance feature supplement vector with the original feature vector to generate an original spliced feature vector; calculating the feature deviation between adjacent trajectory points based on the original spliced feature vector to generate a feature deviation vector; and splicing the feature deviation vector with the original feature vector to generate a trajectory feature vector matrix.
[0007] Furthermore, the generation of navigation distance features based on the AIS data after outlier processing includes: for each track point, calculating the earth radius of the track point using the WGS84 ellipsoid model; for any two track points, calculating the central angle corresponding to the shortest path between the two track points based on the longitude and latitude of the two track points, calculating the average earth radius corresponding to the two track points based on the earth radius of the two track points, and calculating the great circle distance between the two track points based on the average earth radius corresponding to the two track points and the central angle corresponding to the shortest path between the two track points; and generating the navigation distance feature based on the great circle distance between any two track points.
[0008] Furthermore, the great circle distance between two trajectory points is calculated according to the following formula:
[0009] d=R avg ·Δσ
[0010]
[0011] Where d is the latitude and longitude respectively. and The great circle distance between the two trajectory points, R avg The longitude and latitude are and The average radius of the earth at the two trajectory points, Δσ is the longitude and latitude respectively and The central angle corresponding to the shortest path of the two trajectory points, The longitude and latitude are The radius of the Earth at the trajectory point, The longitude and latitude are The radius of the Earth at the trajectory point.
[0012] Furthermore, the trajectory segmentation model of the multi-scale convolution and convolutional attention module includes a downsampling channel, an upsampling channel and a prediction output channel; the downsampling channel is used to extract multi-scale features and enhance them; the upsampling channel is used to fuse the enhanced multi-scale features, restore the spatial resolution, and generate trajectory feature expression; the prediction output channel is used to generate trajectory segmentation results based on the trajectory feature expression.
[0013] Furthermore, the downsampling channel includes a first downsampling layer, four second downsampling layers, a first convolutional pooling layer, a spatial pyramid pooling structure and a convolutional attention module, wherein the first downsampling layer and the second downsampling layer each include multiple ConvBNMish structural units, the ConvBNMish structural unit includes a first convolutional layer, a first normalization layer and a first nonlinear activation function, the second downsampling layer also includes a residual connection block, and a CBAM convolutional attention module is set at the output end of the fourth second downsampling layer.
[0014] Furthermore, the upsampling channel includes five upsampling blocks, wherein the upsampling block includes a ConvBNLeaky structural unit, a first deconvolution operation layer and a second convolution set layer, and the ConvBNLeaky structural unit includes a second convolution layer, a second normalization layer and a LeakyReLU activation function.
[0015] Furthermore, the prediction output channel includes a second deconvolution operation layer and a ConvBNLeaky convolution block.
[0016] Furthermore, the trajectory classification model based on BiLSTM and attention mechanism includes a BiLSTM layer, an attention mechanism layer and a dense connection layer; the BiLSTM layer is used to parallelly process the trajectory segmentation results through forward LSTM units and backward LSTM units, synchronously capture the forward dependency and backward context information of the trajectory points in the time dimension, and construct a trajectory representation vector containing spatiotemporal correlation features; the attention mechanism layer is used to weight the feature dimensions containing key information for classification decision by calculating the attention weight distribution of each time step in the trajectory feature sequence, and generate a weighted composite feature vector; the dense connection layer is used to project the composite feature vector into a preset trajectory behavior category space through nonlinear mapping, and output a trajectory classification result containing the probability distribution of each trajectory category.
[0017] The present invention provides a ship trajectory classification system based on multi-scale convolution and BiLSTM, which applies the above-mentioned ship trajectory classification method based on multi-scale convolution and BiLSTM, including: a model construction module, used to construct a trajectory segmentation model of multi-scale convolution and convolution attention module and a trajectory classification model based on BiLSTM and attention mechanism; a data preprocessing module, used to obtain AIS data, preprocess the AIS data, and extract a trajectory feature vector matrix; a trajectory classification module, used to generate a trajectory segmentation result according to the trajectory feature vector matrix through the trajectory segmentation model of the multi-scale convolution and convolution attention module, and perform trajectory classification according to the trajectory segmentation result through the trajectory classification model based on BiLSTM and attention mechanism.
[0018] Compared with the existing technology, the ship trajectory classification method and system based on multi-scale convolution and BiLSTM provided by the present invention have at least the following beneficial effects:
[0019] Convolution kernels of different scales are used to capture both local and global features of trajectory data. For example, small-scale convolution kernels can extract short-term fluctuations such as ship speed and heading, while large-scale convolution kernels can capture long-term trends such as navigation mode transitions, forming a multi-granular feature representation.
[0020] Through the channel attention and spatial attention mechanisms, feature weights are dynamically adjusted to suppress noise interference, strengthen key features, and improve the robustness of feature representation.
[0021] Bidirectional long short-term memory networks can simultaneously capture the forward and backward temporal dependencies of trajectory data, effectively modeling the contextual information of a ship's navigation behavior. Introducing attention weight distribution after the BiLSTM layer focuses on time steps that have a greater impact on classification decisions, reducing redundant information interference and improving the processing efficiency of long sequence data.
[0022] Through multi-scale convolution and attention mechanisms, continuous trajectories are segmented into semantic segments. Long sequences of ship trajectories are adaptively segmented based on the ship's dynamic navigation characteristics. This addresses issues such as ship segmentation errors and redundant segmentation caused by traditional fixed threshold or fixed time step segmentation. This provides structured input for the classification model and reduces the complexity of subsequent classification tasks. A BiLSTM-attention model based on the segmentation results can perform contextual modeling for different segments, combining global trajectory features with local behavior patterns to improve classification accuracy in complex navigation scenarios.
[0023] Through preprocessing, problems such as uneven AIS data sampling rate and noise interference can be solved, and the quality of input data can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] This specification will be further described in the form of exemplary embodiments, which will be described in detail with reference to the accompanying drawings. These embodiments are not limiting, and in these embodiments, like numbers represent like structures, wherein:
[0025] Figure 1 is a flowchart of a ship trajectory classification method based on multi-scale convolution and BiLSTM according to some embodiments of this specification;
[0026] Figure 2 is a schematic diagram of the structure of a trajectory segmentation model using multi-scale convolution and convolutional attention modules according to some embodiments of this specification;
[0027] Figure 3 is a schematic structural diagram of the first downsampling layer according to some embodiments of this specification;
[0028] Figure 4 is a schematic structural diagram of a second downsampling layer according to some embodiments of this specification;
[0029] Figure 5 is a schematic diagram of the structure of the CBAM convolutional attention module according to some embodiments of this specification;
[0030] Figure 6 is a schematic diagram of the structure of the pyramid pooling structure shown in some embodiments of this specification;
[0031] Figure 7 is a schematic diagram of the structure of an upsampling block according to some embodiments of this specification;
[0032] Figure 8 is a schematic structural diagram of a ConvBNLeaky structural unit according to some embodiments of this specification;
[0033] Figure 9 is a schematic diagram of the structure of a trajectory classification model based on BiLSTM and attention mechanism according to some embodiments of this specification;
[0034] Figure 10 is a schematic diagram of the experimental results of Experiment 1 according to some embodiments of this specification;
[0035] Figure 11 is a schematic diagram of the experimental results of Experiment 2 according to some embodiments of this specification;
[0036] Figure 12 is a schematic diagram of the experimental results of Experiment 3 according to some embodiments of this specification;
[0037] Figure 13This is a module diagram of a ship trajectory classification system based on multi-scale convolution and BiLSTM according to some embodiments of this specification. DETAILED DESCRIPTION
[0038] To more clearly illustrate the technical solutions of the embodiments of this specification, the following briefly describes the drawings required for describing the embodiments. Obviously, the drawings described below are merely examples or embodiments of this specification. Those skilled in the art can apply this specification to other similar scenarios based on these drawings without inventive effort. Unless otherwise apparent from the context or otherwise noted, the same reference numerals in the figures represent the same structure or operation.
[0039] Figure 1 This is a flow chart of a ship trajectory classification method based on multi-scale convolution and BiLSTM according to some embodiments of this specification, such as Figure 1 As shown in FIG, the ship trajectory classification method based on multi-scale convolution and BiLSTM can include the following steps.
[0040] Step 110: construct a trajectory segmentation model of multi-scale convolution and convolutional attention modules.
[0041] Specifically, the ship trajectory classification task can be defined as: given a ship’s AIS trajectory sequence T = {p1, p2, …, p n}, where each data point p i Contains the timestamp, longitude and latitude, speed, heading and other features corresponding to a trajectory point. By designing and training a mapping function f:T→Y, the trajectory sequence or its subsequence is mapped to the trajectory category label y i ∈Y, where Y represents a set of predefined trajectory categories.
[0042] Ship trajectory data is characterized by large data volumes, high temporal sequence, and strong continuity. Existing fixed segmentation strategies or empirical threshold segmentation methods fail to dynamically account for changes in ship trajectories, resulting in fragmented representations of complete ship maneuvers or redundant segmentation points. A trajectory segmentation model combining multi-scale convolution and convolutional attention modules is designed to address these issues.
[0043] Figure 2 is a structural diagram of a trajectory segmentation model of a multi-scale convolution and convolutional attention module according to some embodiments of this specification, such as Figure 2 As shown in Figure 2, the trajectory segmentation model of the multi-scale convolution and convolutional attention module includes a downsampling channel, an upsampling channel, and a prediction output channel;
[0044] The downsampling channel is used to extract multi-scale features and enhance them;
[0045] The upsampling channel is used to fuse the enhanced multi-scale features, restore the spatial resolution, and generate trajectory feature expressions;
[0046] The prediction output channel is used to generate trajectory segmentation results based on trajectory feature expression.
[0047] In some embodiments, the downsampling channel includes a first downsampling layer (DownSample1), four second downsampling layers (DownSample2, DownSample 3, DownSample 4, DownSample 5), a first convolutional set layer (Convset1), a spatial pyramid pooling structure (SPP), and a convolutional block attention module (CBAM), wherein, Figure 3 is a schematic structural diagram of the first downsampling layer according to some embodiments of this specification, Figure 4 is a schematic diagram of the structure of the second downsampling layer according to some embodiments of this specification, such as Figure 3 and Figure 4 As shown, the first downsampling layer and the second downsampling layer both include multiple ConvBNMish structural units. The ConvBNMish structural unit includes the first convolutional layer (Conv1d), the first normalization layer (BatchNorm1d) and the first nonlinear activation function (Mish). In order to deal with the gradient disappearance and feature loss problems that may occur in deep networks, the second downsampling layer also includes a residual connection block (ResBlock) to achieve effective information transmission and effective gradient reflux, thereby effectively alleviating the gradient disappearance problem and ensuring the stability and accuracy of deep feature extraction. A CBAM convolutional attention module is set at the output end of the fourth second downsampling layer to further enhance attention to key features such as speed mutation points or heading turning points. Figure 5 As shown in , the CBAM convolutional attention module consists of two independent submodules: the channel attention module and the spatial attention module. The two modules update the attention weights of the input feature map along the channel and spatial dimensions respectively, and realize adaptive feature optimization by multiplying the input feature map to enhance the model's ability to capture important features, thereby further improving the detection performance. Finally, as Figure 6 As shown in the figure, the pyramid pooling structure (Spatial Pyramid Pooling Layer, SPP) is used to perform pooling operations (Max Pool1D) at multiple scales. By capturing multi-scale information, the global and local semantic expression capabilities are further enriched, thereby enhancing the robustness and generalization ability of the network under complex ship trajectories.
[0048] In order to further enrich the representation capability of the ship trajectory feature vector, an upsampling channel is designed in parallel based on the downsampling channel. In some embodiments, the upsampling channel includes five upsampling blocks, which gradually upsample the deep features extracted by the downsampling channel to restore the spatial resolution of the ship trajectory and fuse multi-scale features to provide a more comprehensive feature expression for the final segmentation prediction. Figure 7 As shown, the upsampling block (UpsampleBlock) includes the ConvBNLeaky structural unit, the first deconvolution operation layer (Upsample), and the second convolution set layer (Convset2). During the data flow, the spatial dimensions of the feature map are gradually enlarged while reducing the number of channels to restore the resolution close to that of the input data. The deconvolution method is used to enlarge the feature map to gradually restore the spatial structure of the trajectory data, providing a high-resolution feature map for subsequent prediction.
[0049] During the upsampling process, jump connections are used to fuse shallow features in the downsampling channels, namely the outputs of the first downsampling layer and the four second downsampling layers, to achieve an effective combination of deep semantic information and shallow detail information. The shallow features provide local position information of the trajectory points, while the deep features represent the global navigation pattern, thereby improving the comprehensiveness of the feature representation.
[0050] like Figure 8 As shown in the figure, the ConvBNLeaky structural unit includes the second convolutional layer, the second normalization layer and the LeakyReLU activation function, which further adjusts the feature distribution, enhances the nonlinear expression ability of the feature vector, and ensures that the feature vector remains robust and discriminative during the spatial resolution restoration process.
[0051] In some embodiments, the prediction output channel includes a second deconvolution operation layer and a ConvBNLeaky convolution block, which is used to convert the feature map of the upsampling channel into the final trajectory segmentation result. Specifically, in the prediction output channel, the deconvolution operation is first used to further restore the spatial resolution of the feature map output by the upsampling channel, so that the dimension of the output data can accurately match the channel dimension of the input data; then the output data from different upsampling layers are spliced and fused, and the average weight of the multi-scale features is obtained through the average pooling operation to represent the multi-scale feature information; finally, prediction classification is performed based on the output of the ConvBNLeaky convolution block to achieve accurate trajectory segmentation with trajectory points as the segmentation granularity.
[0052] Step 120: Build a trajectory classification model based on BiLSTM and attention mechanism.
[0053] like Figure 9As shown in the figure, specifically, the trajectory classification model based on BiLSTM and attention mechanism includes an input layer, a BiLSTM layer, an attention mechanism layer and a dense connection layer.
[0054] The BiLSTM layer is used to process the trajectory segmentation results in parallel through forward LSTM units and backward LSTM units, synchronously capture the forward dependency and backward context information of trajectory points in the time dimension, and construct a trajectory representation vector containing spatiotemporal correlation features.
[0055] Specifically, the BiLSTM layer, consisting of a symmetrical architecture consisting of a forward LSTM and a backward LSTM, implements deep semantic modeling of sequence data through a bidirectional parallel processing mechanism. In the forward LSTM, data is processed sequentially along the time dimension from the initial moment to the final moment, utilizing the input gate, forget gate, and output gate of the memory unit to selectively retain and transmit long-distance dependency information. The backward LSTM processes the sequence data in reverse time sequence to capture dependency characteristics along the reverse time dimension. The bidirectional processing mode fuses forward and reverse time sequence information, addressing the limitation of traditional unidirectional recurrent neural networks that can only utilize unidirectional contextual information. It more comprehensively establishes contextual semantic associations in sequence data, effectively enhancing the ship trajectory classification model's ability to represent complex patterns, thereby improving the model's prediction accuracy and generalization performance in time series classification tasks.
[0056] The attention mechanism layer is used to calculate the attention weight distribution of each time step in the trajectory feature sequence, weight the feature dimensions containing key information for classification decisions (such as heading turning points or speed change points), and generate a weighted composite feature vector, thereby improving the model's ability to perceive important information and helping the ship trajectory classification model make more accurate judgments.
[0057] The dense connection layer is used to project the composite feature vector into the preset trajectory behavior category space through nonlinear mapping, and output the trajectory classification result containing the probability distribution of each trajectory category, thereby enhancing the classification accuracy and model generalization ability.
[0058] Specifically, the weight vector output by the attention mechanism layer is concatenated with the original feature vector to form a composite feature vector fused with the attention weights as input. This layer uses a fully connected network structure to perform deep feature fusion and nonlinear transformation on the input composite feature vector, leveraging dense connections between neurons to achieve mapping and integration of feature dimensions. After processing by the activation function, the final output is a prediction vector containing the probability distribution of each trajectory category. By selecting the category label with the highest probability value, a classification decision is made on the input trajectory data, completing the trajectory classification task. In the densely connected layer, the effective utilization of the feature expression enhanced by the attention mechanism, combined with the powerful feature fusion capabilities of the densely connected layer, improves the discriminative performance and prediction accuracy of the trajectory classification model.
[0059] Step 130: Acquire AIS data, pre-process the AIS data, and extract the trajectory feature vector matrix.
[0060] Specifically, AIS data, as a core data source for ship navigation, covers basic spatiotemporal trajectory information for ships, including dynamic information such as latitude and longitude, course over ground, and speed, as well as static information such as ship type, size, and Maritime Mobile Service Identifier (MMSI). AIS data directly reflects a ship's kinematic characteristics and short-term operational decisions, and serves as the core data support for ship trajectory classification and prediction algorithms.
[0061] Preprocessing is used to solve the problems of different lengths of raw AIS data, outlier interference, and insufficient feature vector representation.
[0062] In some embodiments, step 130 specifically includes:
[0063] Perform position outlier processing and speed outlier processing on AIS data to generate original feature vectors;
[0064] Generate a navigation distance feature supplement vector based on the latitude and longitude feature vector of the original feature vector, and concatenate the navigation distance feature supplement vector with the original feature vector to generate an original concatenated feature vector;
[0065] Based on the original splicing feature vector, the feature deviation between adjacent trajectory points is calculated to generate a feature deviation vector;
[0066] The feature deviation vector is concatenated with the original feature vector to generate the trajectory feature vector matrix.
[0067] Specifically, position outlier processing and speed outlier processing are used to address the original sampling errors in AIS data. The specific process is as follows: first, an initial threshold is set. If the position or speed of the trajectory changes significantly in a short period of time, and the difference in the direction value between the previous and next moments exceeds the set threshold, it is treated as an outlier and the mean interpolation method is used to correct the outlier. The specific calculation is shown in the following formula:
[0068]
[0069] Among them, C t is the abnormal value that needs to be corrected, C t-1 with C t+1 They are the sampling value at the previous moment and the sampling value at the next moment respectively.
[0070] To further address the problem in traditional methods that longitude and latitude feature vectors cannot directly reflect the spatial transformation relationship between consecutive time steps and the physical meaning of the features is ambiguous, it is necessary to convert longitude and latitude data into sailing distance features with clear physical meanings to effectively characterize the spatial relative position relationship between ships, thereby enhancing the model's ability to understand trajectory data and further improving the performance of ship trajectory segmentation and classification. In some embodiments, based on AIS data after outlier processing, sailing distance features are generated, including:
[0071] For each trajectory point, the radius of the earth where the trajectory point is located is calculated using the WGS84 ellipsoid model;
[0072] For any two trajectory points, calculate the central angle corresponding to the shortest path between the two trajectory points based on their longitude and latitude. Calculate the average Earth radius corresponding to the two trajectory points based on the Earth radius where the two trajectory points are located. Calculate the great circle distance between the two trajectory points based on the average Earth radius corresponding to the two trajectory points and the central angle corresponding to the shortest path between the two trajectory points.
[0073] Generate the navigation distance feature based on the great circle distance between any two trajectory points.
[0074] In some embodiments, the great circle distance between two trajectory points is calculated according to the following formula:
[0075] d=R avg ·Δσ
[0076]
[0077] Where d is the latitude and longitude respectively. and The great circle distance between the two trajectory points, R avg The longitude and latitude are and The average radius of the earth at the two trajectory points, Δσ is the longitude and latitude respectively and The central angle corresponding to the shortest path of the two trajectory points, The longitude and latitude are The radius of the Earth at the trajectory point, The longitude and latitude are The radius of the Earth at the trajectory point.
[0078] Based on the use of the distance calculation module to calculate the distance between trajectory points, and to address the problems that the original AIS data can only reflect the trajectory status of the current time step and lacks the representation of the trend change of the feature vector, in order to further enhance the dynamic representation ability of the feature vector, the feature deviation between adjacent trajectory points is calculated and the feature deviation vector is generated to capture the next change trend of the trajectory point, thereby significantly improving the model's ability to understand the future trajectory direction.
[0079] The feature deviation vector is concatenated with the original feature vector to generate a complete trajectory feature vector matrix. The concatenated feature matrix can simultaneously characterize the ship's current navigation status and future navigation trends, providing richer input information for the model and thus optimizing trajectory segmentation and classification performance.
[0080] Step 140: Generate a trajectory segmentation result based on the trajectory feature vector matrix through the trajectory segmentation model of the multi-scale convolution and convolutional attention module.
[0081] Step 150 , using a trajectory classification model based on BiLSTM and attention mechanism, the trajectory is classified according to the trajectory segmentation results.
[0082] The following experiments illustrate the beneficial effects of the ship trajectory classification method based on multi-scale convolution and BiLSTM.
[0083] The experimental process includes four main aspects: First, the AIS data preprocessing algorithm described in this manual is used for experiments, and the effectiveness of the proposed preprocessing algorithm in the segmentation and classification stages of long ship trajectories is analyzed by comparing with the prediction results of the baseline model; Second, the AIS data preprocessing algorithm described in this manual is uniformly used to conduct experiments on the trajectory segmentation model of the multi-scale convolution and convolutional attention module and the trajectory classification model based on BiLSTM and attention mechanism, and the effectiveness of the proposed trajectory segmentation model is analyzed by comparing with the prediction results of the baseline model; Then, the trajectory classification model based on BiLSTM and attention mechanism is used, and the effectiveness of the trajectory classification model based on BiLSTM and attention mechanism is analyzed by comparing with the prediction results of the baseline model; Finally, the trajectory segmentation model of the multi-scale convolution and convolutional attention module and the trajectory classification model based on BiLSTM and attention mechanism are combined to construct an overall classification model, verifying the overall effectiveness of the trajectory segmentation model of the multi-scale convolution and convolutional attention module and the trajectory classification model based on BiLSTM and attention mechanism, and deeply analyzing the role of each model in the proposed method and its contribution to the overall performance.
[0084] 8,800 valid AIS track segments were manually extracted from the raw AIS data to form a ship track classification dataset. These track segments were divided into five categories: Category 1 represents straight-line tracks, Category 2 represents turning tracks, Category 3 represents circling tracks, Category 4 represents stationary tracks, and Category 5 represents reentrant tracks. To further support the training of the track segmentation and track classification networks, the annotated long track sequences were manually segmented into multiple short single-category tracks. This served as the training dataset for the track classification network, while the segmentation points were used as the training dataset for the track segmentation network, ensuring that both networks were trained and optimized on the same data. Objective evaluation metrics were used to evaluate the effectiveness of the AIS data preprocessing algorithm, the track segmentation model using multi-scale convolution and convolutional attention modules, and the track classification model based on the BiLSTM and attention mechanism. These evaluation metrics included average accuracy (Acc), precision (Precision), recall (Recall), balanced F-score (F1-score), and mean average precision (mAP).
[0085] The specific parameters during the training process are shown in Table 1.
[0086] Table 1
[0087]
[0088] To validate the superiority of the data preprocessing algorithm proposed in this manual, the "MSC-CBAM-TSM segmentation-BiLSTM-ATT-TCM classification" model was selected as the baseline model (Base) for comparative experiments. Based on this, the distance calculation module (Dist) and the deviation vector calculation module (Diff) were introduced, and three extended models were constructed: Base+Dist, Base+Diff, and Base+Dist+Diff. The distance calculation module (Dist) generates navigation distance features based on the latitude and longitude feature vectors of the original feature vectors. The deviation vector calculation module (Diff) calculates the feature deviation between adjacent trajectory points based on the navigation distance features to generate a feature deviation vector.
[0089] Through the ablation experiment method, we deeply explored the specific impact of each module in the preprocessing algorithm on the model classification results. The experimental results are as follows: Figure 10As shown, the performance differences of each model in terms of average accuracy, average precision and F1-score are clearly demonstrated. When the baseline model is combined with the distance calculation module (Base+Dist), the average accuracy is improved by 4.6 percentage points compared with the baseline model, and the mAP is improved by 5.1 percentage points; when the baseline model is combined with the deviation vector calculation module (Base+Diff), the average accuracy is improved by 2.5 percentage points compared with the baseline model, and the mAP is improved by 7.4 percentage points; when the baseline model is combined with the distance calculation module and the deviation vector calculation module (Base+Dist+Diff), the average accuracy is improved by 6.8 percentage points compared with the baseline model, and the mAP is significantly improved by 10.6 percentage points. In addition, Figure 10 The experimental results further revealed that after combining the distance calculation module and the deviation vector calculation module, the model's F1-score at different thresholds is higher than that of the baseline model, and the convergence speed of the model training loss is also better than that of the baseline model. Among them, the effect of combining the deviation vector calculation module is particularly outstanding, showing the significant role of this module in improving model performance.
[0090] Based on the above experimental results, in subsequent experiments, the AIS data preprocessing steps were unified to ensure the uniformity and comparability of experimental conditions, so as to more accurately evaluate the performance of the algorithm.
[0091] In order to verify the effectiveness of the trajectory segmentation model of multi-scale convolution and convolutional attention module (MSC-CBAM-TSM), several representative networks were selected as benchmark models for comparative experiments, including: a binary classification network combining LSTM and a fully convolutional network (LSTM-FCN), a binary classification network constructed by a fully convolutional network (CNN-FCN), and a binary classification network combining Transformer and a fully convolutional network (Transformer-FCN). The detailed comparison of the experimental results is shown in the figure. Figure 11 shown.
[0092] Depend on Figure 11As can be seen, the MSC-CBAM-TSM improves the average accuracy by approximately 11.5 percentage points compared to the best-performing LSTM model among the baseline models. In terms of the F1-score metric, when the threshold is set greater than 0.51, the MSC-CBAM-TSM leads the best-performing CNN model among the baseline models by approximately 25.3 percentage points. In terms of mAP, the MSC-CBAM-TSM also outperforms the best-performing LSTM model among the baseline models by approximately 21.8 percentage points. Furthermore, in terms of model convergence, the MSC-CBAM-TSM outperforms the baseline models in terms of training stability, training loss convergence speed, and training fitting performance. This is primarily due to the fact that the spatial characteristics of trajectory segmentation points are more concentrated in local features. Specifically, when local features change significantly, the probability of the local feature being a trajectory segmentation point is higher. The MSC-CBAM-TSM model has advantages over LSTM and Transformer in terms of model architecture by cleverly combining a multi-layer residual structure, a spatial pyramid pooling structure, and a spatial attention mechanism. This allows it to more effectively capture and utilize these local features. In contrast, although the CNN model has its own unique advantages, its network parameter capacity is relatively small, and its receptive field is limited by the size of the convolution kernel, resulting in relatively poor training and fitting effects.
[0093] In order to verify the effectiveness of the trajectory classification model based on BiLSTM and attention mechanism (BiLSTM-ATT-TCM), representative network models were selected as benchmark models for comparative experiments, including: a convolutional classification network composed of multiple layers of residual blocks (ResNet-FCN), a binary classification network combining LSTM and a fully convolutional network (LSTM-FCN), and a binary classification network combining Transformer and a fully convolutional network (Transformer-FCN).
[0094] Comparative experimental results such as Figure 12 As shown in the figure, the BiLSTM-ATT-TCM achieves an improvement of approximately 7.5 percentage points in Acc (Accuracy) over the best-performing LSTM model in the baseline. In terms of F1-score, a comprehensive evaluation metric, the BiLSTM-ATT-TCM outperforms the best-performing Transformer model in the baseline by approximately 7.3 percentage points. In terms of mAP (Mean Average Precision), the BiLSTM-ATT-TCM also outperforms the best-performing LSTM model in the baseline by approximately 11 percentage points.
[0095] The main reasons for this analysis are as follows: Although the ResNet model effectively learns the local features of sequence data through convolutional neural networks, it lacks in-depth capture of contextual information and temporal dependencies in the sequence, resulting in weak overall performance. In contrast, the BiLSTM-ATT-TCM fully utilizes the bidirectional characteristics of the BiLSTM model, comprehensively considers the contextual information relationship of the sequence data, and introduces an attention mechanism in the classification layer. By extracting and outputting the weights that have the greatest influence on the classification results, the model's recognition accuracy and generalization performance are further improved. Therefore, compared with the LSTM and Transformer models, the BiLSTM-ATT-TCM demonstrates superior performance in trajectory classification tasks.
[0096] To comprehensively evaluate the effectiveness of the trajectory segmentation model combining multi-scale convolution and convolutional attention modules, and the overall classification model based on BiLSTM and attention mechanisms, we conducted comparative experiments using different combination strategies. Unlike the previous experiments, this experiment directly uses long sequences of trajectories as input, allowing the model to autonomously segment and classify the trajectories. The detailed parameters of the test set are shown in Table 2, which includes 379 trajectory segmentation points and 8547 trajectory classification points.
[0097] Table 2
[0098]
[0099] To fully validate the effectiveness of the overall classification model combining a multi-scale convolutional and convolutional attention module with a trajectory classification model based on a BiLSTM and attention mechanism, we conducted systematic comparative experiments by designing various segmentation methods and classification model combinations. The classification accuracy statistics of different strategies on the test set are shown in Table 3. The experimental data show that the classification performance of all compared models significantly decreases when fed long sequences of trajectory data. This is primarily due to the high complexity of contextual dependencies in long trajectories and the sensitivity of the trajectory segmentation strategy. If illogical segmentation occurs during segmentation, such as misclassifying a trajectory containing turning features into two straight segments, the trajectory classification network will struggle to effectively capture the temporal features and spatial semantic associations in the trajectory data, thereby reducing the model's ability to express trajectory features and ultimately leading to a significant decrease in classification accuracy.
[0100] Table 3
[0101]
[0102] Experimental results show that the overall classification model, combining a trajectory segmentation model with multi-scale convolution and convolutional attention modules and a trajectory classification model based on BiLSTM and attention mechanisms, demonstrates significant advantages in accuracy. By integrating a multi-scale convolution mechanism with a bidirectional long short-term memory network, this model achieves efficient feature extraction and semantic modeling for long-sequence trajectory data. Compared to the two traditional segmentation strategies of "fixed-length segmentation-BiLSTM-ATT-TCM classification" and "fixed-length segmentation-LSTM classification," its classification accuracy improves by 19 percentage points and 23 percentage points, respectively. It also outperforms the next-best algorithm model, "LSTM segmentation-BiLSTM-ATT-TCM classification," by 8 percentage points, achieving an accuracy of 0.8855 on the test set. This result fully demonstrates the effectiveness of the overall classification model combining a multi-scale convolutional and convolutional attention module trajectory segmentation model and a BiLSTM-based trajectory classification model with an attention mechanism. This model significantly improves the accuracy and reliability of trajectory classification, particularly when processing long sequences of ship trajectory data. Furthermore, experimental results demonstrate that a reasonable trajectory segmentation method is crucial for improving ship trajectory classification performance.
[0103] Figure 13 is a module diagram of a ship trajectory classification system based on multi-scale convolution and BiLSTM according to some embodiments of this specification, such as Figure 13 As shown in FIG, the ship trajectory classification system based on multi-scale convolution and BiLSTM can include a model building module, a data preprocessing module and a trajectory classification module.
[0104] Model building module, used to build a trajectory segmentation model based on multi-scale convolution and convolutional attention modules and a trajectory classification model based on BiLSTM and attention mechanism;
[0105] Data preprocessing module, used to obtain AIS data, preprocess the AIS data, and extract the trajectory feature vector matrix;
[0106] The trajectory classification module is used to generate trajectory segmentation results based on the trajectory feature vector matrix through the trajectory segmentation model of the multi-scale convolution and convolution attention modules, and to perform trajectory classification based on the trajectory segmentation results through the trajectory classification model based on BiLSTM and attention mechanism.
[0107] The ship trajectory classification system based on multi-scale convolution and BiLSTM can be used to execute the ship trajectory classification method based on multi-scale convolution and BiLSTM, which will not be described here.
[0108] Finally, it should be understood that the embodiments described in this specification are intended only to illustrate the principles of the embodiments of this specification. Other variations may also fall within the scope of this specification. Therefore, by way of example and not limitation, alternative configurations of the embodiments of this specification may be considered consistent with the teachings of this specification. Accordingly, the embodiments of this specification are not limited to the embodiments explicitly described and illustrated in this specification.
Claims
1. The ship trajectory classification method based on multi-scale convolution and BiLSTM is characterized by: include: Construct a trajectory segmentation model with multi-scale convolution and convolutional attention modules; Build a trajectory classification model based on BiLSTM and attention mechanism; Acquire AIS data, pre-process the AIS data, and extract the trajectory feature vector matrix; The trajectory segmentation model of the multi-scale convolution and convolutional attention modules generates trajectory segmentation results according to the trajectory feature vector matrix; Trajectory classification is performed based on the trajectory segmentation results using a trajectory classification model based on BiLSTM and attention mechanism.
2. The ship trajectory classification method based on multi-scale convolution and BiLSTM according to claim 1 is characterized in that: The preprocessing of the AIS data to extract the trajectory feature vector matrix includes: Perform position outlier processing and speed outlier processing on AIS data to generate original feature vectors; Generate a navigation distance feature supplement vector based on the latitude and longitude feature vector of the original feature vector, and concatenate the navigation distance feature supplement vector with the original feature vector to generate an original concatenated feature vector; Based on the original splicing feature vector, the feature deviation between adjacent trajectory points is calculated to generate a feature deviation vector; The feature deviation vector is concatenated with the original feature vector to generate the trajectory feature vector matrix.
3. The ship trajectory classification method based on multi-scale convolution and BiLSTM according to claim 2 is characterized in that: The generation of navigation distance features based on the AIS data after outlier processing includes: For each trajectory point, the radius of the earth where the trajectory point is located is calculated using the WGS84 ellipsoid model; For any two trajectory points, calculate the central angle corresponding to the shortest path between the two trajectory points based on their longitude and latitude. Calculate the average Earth radius corresponding to the two trajectory points based on the Earth radius where the two trajectory points are located. Calculate the great circle distance between the two trajectory points based on the average Earth radius corresponding to the two trajectory points and the central angle corresponding to the shortest path between the two trajectory points. Generate the navigation distance feature based on the great circle distance between any two trajectory points.
4. The ship trajectory classification method based on multi-scale convolution and BiLSTM according to claim 3 is characterized in that: The great circle distance between two trajectory points is calculated according to the following formula: d=R avg ·Board Where d is the latitude and longitude respectively. and The great circle distance between the two trajectory points, R avg The longitude and latitude are and The average radius of the earth at the two trajectory points, Δσ is the longitude and latitude respectively and The central angle corresponding to the shortest path of the two trajectory points, The longitude and latitude are The radius of the Earth at the trajectory point, The longitude and latitude are The radius of the Earth at the trajectory point.
5. The ship trajectory classification method based on multi-scale convolution and BiLSTM according to any one of claims 1 to 4, characterized in that: The trajectory segmentation model of the multi-scale convolution and convolutional attention module includes a downsampling channel, an upsampling channel and a prediction output channel; The downsampling channel is used to extract multi-scale features and enhance them; The upsampling channel is used to fuse the enhanced multi-scale features, restore the spatial resolution, and generate trajectory feature expressions; The prediction output channel is used to generate trajectory segmentation results based on trajectory feature expression.
6. The ship trajectory classification method based on multi-scale convolution and BiLSTM according to claim 5 is characterized in that: The downsampling channel includes a first downsampling layer, four second downsampling layers, a first convolutional set layer, a spatial pyramid pooling structure and a convolutional attention module, wherein the first downsampling layer and the second downsampling layer each include multiple ConvBNMish structural units, the ConvBNMish structural unit includes a first convolutional layer, a first normalization layer and a first nonlinear activation function, the second downsampling layer also includes a residual connection block, and a CBAM convolutional attention module is set at the output end of the fourth second downsampling layer.
7. The ship trajectory classification method based on multi-scale convolution and BiLSTM according to claim 5 is characterized in that: The upsampling channel includes five upsampling blocks, wherein the upsampling block includes a ConvBNLeaky structural unit, a first deconvolution operation layer and a second convolution set layer, and the ConvBNLeaky structural unit includes a second convolution layer, a second normalization layer and a LeakyReLU activation function.
8. The ship trajectory classification method based on multi-scale convolution and BiLSTM according to claim 5 is characterized in that: The prediction output channel includes a second deconvolution operation layer and a ConvBNLeaky convolution block.
9. The ship trajectory classification method based on multi-scale convolution and BiLSTM according to any one of claims 1 to 4, characterized in that: The trajectory classification model based on BiLSTM and attention mechanism includes a BiLSTM layer, an attention mechanism layer and a dense connection layer; The BiLSTM layer is used to process the trajectory segmentation results in parallel through forward LSTM units and backward LSTM units, synchronously capturing the forward dependency and backward context information of trajectory points in the time dimension, and constructing a trajectory representation vector containing spatiotemporal correlation features; The attention mechanism layer is used to weight the feature dimensions containing key information for classification decisions by calculating the attention weight distribution of each time step in the trajectory feature sequence, and generate a weighted composite feature vector; The dense connection layer is used to project the composite feature vector into the preset trajectory behavior category space through nonlinear mapping, and output the trajectory classification result containing the probability distribution of each trajectory category.
10. The ship trajectory classification system based on multi-scale convolution and BiLSTM is characterized by: The ship trajectory classification method based on multi-scale convolution and BiLSTM according to any one of claims 1 to 9 is applied, comprising: Model building module, used to build a trajectory segmentation model based on multi-scale convolution and convolutional attention modules and a trajectory classification model based on BiLSTM and attention mechanism; Data preprocessing module, used to obtain AIS data, preprocess the AIS data, and extract the trajectory feature vector matrix; The trajectory classification module is used to generate trajectory segmentation results based on the trajectory feature vector matrix through the trajectory segmentation model of the multi-scale convolution and convolution attention modules, and to perform trajectory classification based on the trajectory segmentation results through the trajectory classification model based on BiLSTM and attention mechanism.