Research on Ship Trajectory Classiﬁcation Based on a Deep Convolutional Neural Network

: With the aim of solving the problems of ship trajectory classiﬁcation and channel iden-tiﬁcation, a ship trajectory classiﬁcation method based on deep a convolutional neural network is proposed. First, the ship trajectory data are preprocessed using the improved QuickBundle clustering algorithm. Then, data are converted into ship trajectory image data, a dataset is established, a deep convolutional neural network-based ship trajectory classiﬁcation model is constructed, and the manually annotated dataset is used for training. The fully connected neural network model and SVM model with latitude and longitude data as input are selected for comparative analysis. The results show that the ship trajectory classiﬁcation model based on a deep convolutional neural network can effectively distinguish ship trajectories in different waterways, and the proposed method is an effective ship trajectory classiﬁcation method


Introduction
A ship automatic identification system (AIS) is an open data transmission system widely used in the fields of ship traffic information collection and analysis, ship navigation monitoring, and water traffic planning.The ship trajectory data collected by AIS has the advantages of massiveness and large geographical scope, but the data time interval is too large, and the quality is not high, which introduces challenges to the classification of ship trajectory.
At present, the specific application scenarios of ship trajectory classification methods at home and abroad mainly include the identification of ship types and the classification of ship motion patterns.The realization process is divided into three parts: feature extraction, transformation of ship trajectory data, and modeling of classification models.Chen et al. [1] realized the classification of AIS ship trajectory based on the sparse representation classification algorithm and conducted experiments in the waters of the Yangtze River.The cubic spline method is used to approximate the trajectory of a ship, which may destroy the characteristics of the trajectory of the ship.Kraus et al. [2] used the random forest algorithm to classify ship type by extracting geographic features (navigation route, stay area, etc.) and behavior features (heading, speed, etc.) of the ship's trajectory and achieved 97.51% recognition accuracy.Based on the AIS ship trajectory, Sánchez et al. [3][4][5][6][7] used SVM and a decision tree to achieve binary classification of fishing boats and preprocessed the trajectory by data cleaning, data filtering, trajectory segmentation, feature extraction and other methods to improve the accuracy of classification.Liu et al. [8] used a semi-supervised deep learning model (SCEDN) for classification in the case of ship encounters, which used an encoder-decoder convolutional structure with four channels (distance, speed to approach point) for each segment time (TCPA) and distance to approach point (DCPA)).Sheng et al. [9][10][11][12][13][14][15] divided the ship's trajectory into three motion modes: anchoring, going straight, and turning.According to factors such as speed and heading, the behavior characteristics of the three modes were extracted, and the ship trajectory feature classification model was established by logistic regression.Cui Tong et al. [16][17][18][19][20][21][22] combined LSTM and CNN to establish a hybrid classification model, which is characterized by speed, acceleration, heading and curvature, with feature vectors as inputs and ship shape as output.In this method, CNN is used to extract the spatial features of the trajectory data, and LSTM is used to extract the temporal features of the trajectory data.Because ship trajectory data belong to spatial data, in this paper, we refer to some methods for trajectory image classification.
However, with respect to the relevant research results at home and abroad, the following research trends and directions are observed.Research on ship trajectory clustering is gradually developing towards efficient execution and extraction of diversified trajectory data features, and research on trajectory classification is gradually developing towards accurate feature extraction and the establishment of mathematical models based on deep learning.Combined with the main research objects of this paper, the current research has the following shortcomings: 1.
Most of the current ship trajectory clustering methods are based on the density clustering algorithm of DBSCAN.Although the algorithm complexity is high, there is room for improvement in execution efficiency, and it is difficult to select the dual parameters of DBSCAN.

2.
When domestic and foreign scholars use supervised algorithms for ship trajectory classification, there is still room for improvement in the use of ship trajectory spatial feature information and the process of extracting features, such as ship trajectory heading and speed.
The main work of this paper: In this paper, we take ship trajectory data as the research object and investigate a fast, efficient and accurate ship trajectory clustering method for waters with dense and complex traffic flow that obtains the ship trajectory data of various clusters in the water area.In this paper, we use the clustered ship trajectory data as the basis to study ship trajectory anomaly detection a channel classification so as to provide decision support for intelligent risk management and control of ship traffic control departments.Specifically, the main research work of this paper is as follows: The main task of ship trajectory preprocessing is to eliminate interference trajectories by eliminating ship trajectories that are concentrated in a small area of water with little movement or ship trajectories with a sampling interval that is too long to characterize continuous motion characteristics, eliminating the interference of ship anchor points in trajectory analysis of moving ships, and reducing the complexity of ship trajectories.Under the premise of ship trajectory preprocessing, in this paper, we use the QuickBundles algorithm as a basic method to carry out ship trajectory clustering research.First, we analyze the performance of three trajectory similarity measurement methods, MDF [23], DTW [24], and Hausdorff [25].Then, aiming at the problem of insufficient sampling of local features of ship trajectory by the QuickBundles algorithm, a sampling method based on heading is used to improve it, and an improved QuickBundles ship trajectory clustering algorithm is proposed.We use the improved QuickBundles algorithm [26] to establish a clustering model of ship trajectories, determine appropriate thresholds according to a variety of evaluation indicators, complete the task of ship trajectory clustering, and conduct comparative experiments with the improved QuickBundles algorithm and the traditional DBSCAN [27] algorithm.
In view of the problem of ship trajectory classification based on latitude and longitude data, the spatial characteristics of the data are not obvious, and the classification effect is not ideal.In this paper, we propose a ship trajectory classification method based on a deep convolutional neural network to classify the channel to which a ship trajectory belongs, achieving the recognition of ship trajectories and waterways.Based on the clustering results, the latitude and longitude coordinates are mapped to the image pixel coordinates according to the scale, the spatial characteristics of the ship trajectory data are extracted, and the ship trajectory image dataset is established.The ship trajectory classification model based on a deep convolutional neural network is established according to on the ResNet50 [28] model, using the training set to train the model.On the test set, the fully connected neural network and multi-class SVM classifier [29] with latitude and longitude data as input are used for comparison with the deep convolution model with trajectory image data as input.
The main contributions include: • An improved QuickBundles ship trajectory clustering algorithm is proposed.

•
A method of ship trajectory classification based on a deep convolutional neural network is proposed that realizes the classification and identification of the waterway to which a ship trajectory belongs.
The contents of this paper are organized as follows: Section 2 provides details of the proposed scheme, the result analysis is shown in Section 3, and conclusions are presented in Section 4.

Methods
The working process of the proposed methodology is shown in Figure 1.This method takes specific ship trajectory AIS data as the research object and focuses on ship trajectory clustering, ship trajectory anomaly detection, and channel identification of ship trajectories in dense-traffic waters.Through the identification of abnormal trajectories and the classification of the channel to which a trajectory belongs, the ship supervision department provides technical support for targeted ship trajectory data analysis.Ship trajectory clustering research is carried out based on the QuickBundles clustering algorithm.The sampling method of QuickBundles is improved according to the local heading changes of the ship trajectory, and a fast, accurate, and efficient ship trajectory clustering method is proposed.Ship trajectory clustering research also provides cluster quantity parameters for anomaly detection models and data support for ship trajectory classification.
a deep convolutional neural network to classify the channel to which a ship trajectory belongs, achieving the recognition of ship trajectories and waterways.Based on the clustering results, the latitude and longitude coordinates are mapped to the image pixel coordinates according to the scale, the spatial characteristics of the ship trajectory data are extracted, and the ship trajectory image dataset is established.The ship trajectory classification model based on a deep convolutional neural network is established according to on the ResNet50 [28] model, using the training set to train the model.On the test set, the fully connected neural network and multi-class SVM classifier [29] with latitude and longitude data as input are used for comparison with the deep convolution model with trajectory image data as input.
The main contributions include:

•
An improved QuickBundles ship trajectory clustering algorithm is proposed.

•
A method of ship trajectory classification based on a deep convolutional neural network is proposed that realizes the classification and identification of the waterway to which a ship trajectory belongs.
The contents of this paper are organized as follows: Section 2 provides details of the proposed scheme, the result analysis is shown in Section 3, and conclusions are presented in Section 4.

Methods
The working process of the proposed methodology is shown in Figure 1.This method takes specific ship trajectory AIS data as the research object and focuses on ship trajectory clustering, ship trajectory anomaly detection, and channel identification of ship trajectories in dense-traffic waters.Through the identification of abnormal trajectories and the classification of the channel to which a trajectory belongs, the ship supervision department provides technical support for targeted ship trajectory data analysis.Ship trajectory clustering research is carried out based on the QuickBundles clustering algorithm.The sampling method of QuickBundles is improved according to the local heading changes of the ship trajectory, and a fast, accurate, and efficient ship trajectory clustering method is proposed.Ship trajectory clustering research also provides cluster quantity parameters for anomaly detection models and data support for ship trajectory classification.

The Improved QuickBundles Algorithm Module
The trajectory of a ship can be of any length.Before the task of clustering the trajectory of the ship, data need to be divided and filtered so that the subtrajectory segments with similar motion characteristics can be retained and some important information can be obtained; therefore, it is very important to properly divide the original trajectory.Commonly used methods of ship trajectory division are based on time interval and speed changes.
The data used in this paper come from the US Coastal AIS Vessel Traffic Data (https://marinecadastre.gov/ais/, accessed on 1 March 2022), which are collected by the US Coast Guard through on-board navigation and positioning equipment to monitor the location of large ships in the United States, as well as characteristics of coastal waters.In this section, we take the AIS dataset from January to March 2019 as the experimental object and use two methods to process ship trajectory data.The specific parameter settings are shown in Table 1, and the processing results are shown in Table 2.The QuickBundles algorithm was originally designed for use with nerve bundles in the medical field.The local changes of nerve bundles are not complicated.Therefore, the QuickBundles algorithm uses only simple linear interpolation as the sampling method.However, if the clustering object is a ship trajectory with moving characteristics and the local heading changes are more complicated, then the characteristic changes of these local headings cannot be ignored, e.g., the 20 ship trajectory points shown in Figure 2a,b.In the original trajectory, the ship's course changes considerably due to reasons such as avoidance, and the changed trajectory is curved and smooth.After sampling by the QuickBundles algorithm, the local features of this heading change are replaced by simple polylines; the ship in the original trajectory in Figure 2c has a short, straight line at the turn.After being sampled by the QuickBundles algorithm, this short straight line is ignored.
In order to overcome the above shortcomings, we improve the sampling method of the QuickBundles algorithm.First, the ship's trajectory is compressed, with the heading as a factor, and the key position points of the ship's trajectory are extracted.Then, the ship trajectory is interpolated based on the distance between the trajectory points.

• Ship trajectory compression considering heading
There are two purposes for ship trajectory compression in this paper: one is to reduce the number of trajectory points of all ship trajectories so as to more conveniently achieve the unification of the number of trajectory points in the future; the other is to reduce the number of trajectory points to improve the similarity between trajectories and calculate efficiency.
The course can indicate the direction of a ship's trajectory and the trend of a ship's movement.Figure 3 shows the difference in heading angle.The heading angle difference (AD) represents the difference in the direction angle of the adjacent ship trajectory segment, which can more clearly illustrate the change in the current trajectory segment compared to the previous trajectory segment.Through the calculation of the heading angle difference, the key position points in the trajectory of a ship can be accurately obtained, and the compression of the trajectory of the ship can be determined.The detailed calculation process is shown in Figure 4.The input is the angle threshold and the ship trajectory.The heading angle difference between the current trajectory point and the previous trajectory point is calculated.If the heading angle difference is greater than the threshold, the current trajectory point is retained; otherwise, the current trajectory point is deleted.

Subsection interpolation based on the distance between track points
The QuickBundles clustering algorithm requires that the trajectories to be clustered have the same number of trajectory points.After compressing the ship's trajectory, in order to meet this requirement, in this section, we adopt the segmented interpolation method based on the distance between the trajectory points to unify the number of ship trajectory points.The specific process is shown in Figure 5. First, the number of track points to be inserted is obtained, and then the distance between each adjacent track point is calculated.According to the ratio between the distances, the number of inserted track points to the track to be inserted in each segment is allocated a corresponding number of points.

• Ship trajectory compression considering heading
There are two purposes for ship trajectory compression in this paper: one is to reduce the number of trajectory points of all ship trajectories so as to more conveniently achieve the unification of the number of trajectory points in the future; the other is to reduce the number of trajectory points to improve the similarity between trajectories and calculate efficiency.
The course can indicate the direction of a ship's trajectory and the trend of a ship's movement.Figure 3 shows the difference in heading angle.The heading angle difference (AD) represents the difference in the direction angle of the adjacent ship trajectory segment, which can more clearly illustrate the change in the current trajectory segment compared to the previous trajectory segment.Through the calculation of the heading angle difference, the key position points in the trajectory of a ship can be accurately obtained, and the compression of the trajectory of the ship can be determined.The detailed calculation process is shown in Figure 4.The input is the angle threshold and the ship trajectory.The heading angle difference between the current trajectory point and the previous trajectory point is calculated.If the heading angle difference is greater than the threshold, the current trajectory point is retained; otherwise, the current trajectory point is deleted.

• Subsection interpolation based on the distance between track points
The QuickBundles clustering algorithm requires that the trajectories to be clustered have the same number of trajectory points.After compressing the ship's trajectory, in order to meet this requirement, in this section, we adopt the segmented interpolation method based on the distance between the trajectory points to unify the number of ship trajectory points.The specific process is shown in Figure 5. First, the number of track points to be inserted is obtained, and then the distance between each adjacent track point is calculated.According to the ratio between the distances, the number of inserted track points to the track to be inserted in each segment is allocated a corresponding number of points.

Ship Trajectory Classification Module
In the key monitoring areas of ports, seaports, and other regulatory agencies, as the flow of ships increases, an efficient ship trajectory classification algorithm is needed to classify ships in the jurisdiction, improve the level of intelligent management and supervision efficiency, and reduce busy waters.There is a risk of major and catastrophic traffic

Ship Trajectory Classification Module
In the key monitoring areas of ports, seaports, and other regulatory agencies, as the flow of ships increases, an efficient ship trajectory classification algorithm is needed to classify ships in the jurisdiction, improve the level of intelligent management and supervision efficiency, and reduce busy waters.There is a risk of major and catastrophic traffic accidents.In this section, we use the trajectory clustering results as the training dataset to investigate the classification of ship trajectories and propose a ship trajectory classification method based on deep convolutional neural networks.

Longitude and Latitude Mapping and Coordinate Conversion
The latitude range of the water area where the experimental data in this article are located is 48 degrees 9 min 7.28 s north latitude to 49 degrees 6 min 44.28 s north latitude, and the longitude range is 123 degrees 3 min 43.33 s west longitude to 123 degrees 42 min 2.71 s west longitude, as shown in Figure 6.In this section, we assume that the area is the key monitoring area of the ship supervision department, model the area and convert the latitude and longitude data into image data according to the length and width ratio of the water area where the experimental data are located.The latitude range of the water area where the experimental data in this article ar located is 48 degrees 9 min 7.28 s north latitude to 49 degrees 6 min 44.28 s north latitude and the longitude range is 123 degrees 3 min 43.33 s west longitude to 123 degrees 42 mi 2.71 s west longitude, as shown in Figure 6.In this section, we assume that the area is th key monitoring area of the ship supervision department, model the area and convert th latitude and longitude data into image data according to the length and width ratio of th water area where the experimental data are located.

Calculation of the Aspect Ratio of the Water Area
The water area where the experimental data are located is a rectangular area, and th aspect ratio is obtained by calculating the distance between the two sides of the rectangu lar area to determine the image resolution using the Haversine formula [30] to calculat the distance between two longitude and latitude coordinate points.Formula (1) intro duces the method for calculating the distance between two longitude and latitude coord nate points when two longitude and latitude coordinate points are known. is the radiu of the earth, and the average value is 6371 km. and  represent the latitude of th two points, and ∆ represents the difference between the longitudes of the two points According to this calculation, the length of the experimental area is 28.41 km, the width i 17.82 km, and the approximate ratio is 14:9.
ℎ sin   = ℎ sin  −  + cos  cos  ℎ sin ∆ (1 The higher the image resolution, the higher the computational cost and the lower th computational efficiency of the deep convolutional neural network.Considering th above problems, in this paper, we set the resolution to 112 ⋇ 72 , keeping the ratio of th image unchanged at 14:9 so that the latitude value of (49.06, 48.90) is mapped to the rang of the pixel point (0, 71) inside, the longitude value of (−123.42,−123.03) is mapped to th pixel point (0, 111) range, as shown in Figure 7.

Calculation of the Aspect Ratio of the Water Area
The water area where the experimental data are located is a rectangular area, and the aspect ratio is obtained by calculating the distance between the two sides of the rectangular area to determine the image resolution using the Haversine formula [30] to calculate the distance between two longitude and latitude coordinate points.Formula (1) introduces the method for calculating the distance between two longitude and latitude coordinate points when two longitude and latitude coordinate points are known.R is the radius of the earth, and the average value is 6371 km.ϕ 1 and ϕ 2 represent the latitude of the two points, and ∆λ represents the difference between the longitudes of the two points.According to this calculation, the length of the experimental area is 28.41 km, the width is 17.82 km, and the approximate ratio is 14:9.
The higher the image resolution, the higher the computational cost and the lower the computational efficiency of the deep convolutional neural network.Considering the above problems, in this paper, we set the resolution to 112 72, keeping the ratio of the image unchanged at 14:9 so that the latitude value of (49.06, 48.90) is mapped to the range of the pixel point (0, 71) inside, the longitude value of (−123.42,−123.03) is mapped to the pixel point (0, 111) range, as shown in Figure 7. Figure 8 shows the ship trajectory image data after the latitude and longitude data of the ship trajectory are converted.According to the clustering results in Section 3, there are five types of ship trajectories in the waters where the experimental data are located based on the channel category division, so the label of the dataset is set to 0, 1, 2, 3, 4. The resolution of each ship trajectory image is 112 ⋇ 72, which corresponds to the latitude and longitude range of the water area.The specific dataset details, as well as the division of training set and test set are shown in Table 3.   Figure 8 shows the ship trajectory image data after the latitude and longitude data of the ship trajectory are converted.According to the clustering results in Section 3, there are five types of ship trajectories in the waters where the experimental data are located based on the channel category division, so the label of the dataset is set to 0, 1, 2, 3, 4. The resolution of each ship trajectory image is 112 ⋇ 72, which corresponds to the latitude and longitude range of the water area.The specific dataset details, as well as the division of training set and test set are shown in Table 3.    [31] is widely used in target classification and other fields.It is a part of the classic backbone neural network for computer vision tasks.Typical networks include ResNet50, ResNet101, etc.The ResNet network proves that convolutional neural networks can develop more deeply (including more hidden layers) and verifies that deep convolutional neural networks have better performance.
ResNet50 has a unique residual structure, as shown in Figure 9.One of the core technologies of the residual structure is the use of a shortcut connection.There are two main reasons for the disappearance of the gradient.When the number of network layers is very deep and the layer where the current parameter is located is close to the input of the network, the derivation chain is very long; if some of the intermediate results have a low value, after chain accumulation, the final gradient value will be close to zero, resulting in the parameters not being updated.The input is directly added to the output obtained through the convolution operation, which can avoid the problem of the disappearance of the gradient and can capture small perturbations.In addition, the first and last ends of the residual structure use convolution to reduce and restore data dimensions.The time complexity of the two structures is similar, but it deepens the number of network layers and structures and resolves network degradation and training process performance.As shown in Figures 10 and 11, in the actual processing step, jump connections are divided into two types according to the size of the input and output of the residual block.One is the identity block (ID BLOCK) when the input and output are consistent, and the other is the convolutional block (CONV BLOCK) when the input and output are inconsistent.The jump connection is processed by convolution calculation to achieve unity of input and output dimensions.ResNet50 adopts small-size convolution kernels and uses batch normalization [32]

Model Building
The ship trajectory classification network structure proposed in this paper is in Figure 12 and Table 4.The structure is composed of five convolution blocks sta sequence.Each convolution block contains the residual network substructure sh Figure 11.The residual network substructure in different convolution blocks has d numbers of convolution kernels.The input layer dimension parameter of the n model is set to 112 * 72 * 3, the mini batch size is set to 64, and the output layer c is set to 5.

Model Building
The ship trajectory classification network structure proposed in this paper is shown in Figure 12 and Table 4.The structure is composed of five convolution blocks stacked in sequence.Each convolution block contains the residual network substructure shown in Figure 11.The residual network substructure in different convolution blocks has different numbers of convolution kernels.The input layer dimension parameter of the network model is set to 112 * 72 * 3, the mini batch size is set to 64, and the output layer category is set to 5.

Model Building
The ship trajectory classification network structure proposed in this paper is shown in Figure 12 and Table 4.The structure is composed of five convolution blocks stacked in sequence.Each convolution block contains the residual network substructure shown in Figure 11.The residual network substructure in different convolution blocks has different numbers of convolution kernels.The input layer dimension parameter of the network model is set to 112 * 72 * 3, the mini batch size is set to 64, and the output layer category is set to 5.

Model Building
The ship trajectory classification network structure proposed in this paper is shown in Figure 12 and Table 4.The structure is composed of five convolution blocks stacked in sequence.Each convolution block contains the residual network substructure shown in Figure 11.The residual network substructure in different convolution blocks has different numbers of convolution kernels.The input layer dimension parameter of the network model is set to 112 * 72 * 3, the mini batch size is set to 64, and the output layer category is set to 5.

Model Training
Assuming that the ship trajectory image data point is , because the pixel values of the image data are in the range of (0, 255), each data point is normalized before model training, as shown in formula (2), and the data format is converted to the float32 data type in the tensorflow framework.

Experimental Environment and Hyperparameters
This experiment runs on the tensorflow deep learning framework and uses a GTX1060 graphics card for training.The hyperparameter settings are shown in Table 5.

Model Training
Assuming that the ship trajectory image data point is X, because the pixel values of the image data are in the range of (0, 255), each data point is normalized before model training, as shown in formula (2), and the data format is converted to the float32 data type in the tensorflow framework.

Experimental Environment and Hyperparameters
This experiment runs on the tensorflow deep learning framework and uses a GTX1060 graphics card for training.The hyperparameter settings are shown in Table 5.It is designed to solve the problem that SGD has good convergence effect but slow speed, whereas Adam converges quickly, it is not easy to converge to the local optimal solution.Based on variance dispersion, Radam dynamically turns on and off the adaptive learning rate and realizes a method that does not need to warm up the learning rate in the adjustable parameters.
It has the advantages of both Adam and SGD, which can ensure fast convergence speed and does easily fall into the local optimal solution.In the case of a high learning rate, the accuracy of Radam is better than that of SGD.In addition, for the multi-classification problem, the cross-entropy loss function and the Softmax activation function are used.In this paper, we use Radam as the optimizer.Radam is a deep learning optim proposed by Chinese doctoral student Liu Yiyuan in 2019.It is designed to solve the pr lem that SGD has good convergence effect but slow speed, whereas Adam conver quickly, it is not easy to converge to the local optimal solution.Based on variance disp sion, Radam dynamically turns on and off the adaptive learning rate and realize method that does not need to warm up the learning rate in the adjustable parameters.
It has the advantages of both Adam and SGD, which can ensure fast converge speed and does easily fall into the local optimal solution.In the case of a high learn rate, the accuracy of Radam is better than that of SGD.In addition, for the multi-clas cation problem, the cross-entropy loss function and the Softmax activation function used.

Training Effect Analysis
In this paper, we use the Tensorboard data analysis visualization tool in Tensorf to analyze the model training effect.Figure 13 shows the change in loss value during training process, with the number of iterations set to 20.With the increase in the num of iterations, the loss curve of the ship trajectory classification model shows a converge trend as a whole, with a small fluctuation between the fourth and eighth iterations finally converging around 0.04.The training results show that the model has learned data features of the ship trajectory images and the model training has achieved the pected effect.Figure 14

Results of the Improved QuickBundles Clustering Algorithm.
In order to further verify the clustering ability of the improved QuickBundles clu tering algorithm for ship trajectory, in this paper, we compare and analyze the clusterin effect and execution efficiency of the improved QuickBundles clustering algorithm, th QuickBundles clustering algorithm, and the DBSCAN algorithm.In the experiment, th thresholds of the three clustering algorithms are the best clustering thresholds obtaine in Section 3.1.
The comparison results of the contour coefficients of the three clustering algorithm are shown in Figure 15a.The contour coefficient of DBSCAN is 0.5568, the contour coef cient of the QuickBundles clustering algorithm is 0.6173, and the contour coefficient of th improved QuickBundles clustering algorithm is 0.6380.The QuickBundle clustering alg rithm surpasses the other two algorithms according to various metrics.Figure 16 show the statistics of the three clustering algorithms.The distribution of contour coefficients all trajectory data, the mean, upper quartile, median, and lower quartile of the improve QuickBundles clustering algorithm in the figure are higher than those of the QuickBu dles clustering algorithm and the DBSCAN algorithm.The CHI comparison results of th three algorithms are shown in Figure 15b.The CHI of the improved QuickBundles clu tering algorithm is 3769.2168,which is significantly higher than the other two compariso algorithms.Figure 15c shows the DBI comparison results of the three algorithms.For th ship trajectory data, the improved QuickBundles clustering algorithm is better than th other two algorithms.In terms of algorithm execution efficiency, as shown in Figure 15 the improved QuickBundles clustering algorithm is only 305 milliseconds slower than th QuickBundles clustering algorithm, and the execution time of DBSCAN is less than 20 s.

Results of the Improved QuickBundles Clustering Algorithm
In order to further verify the clustering ability of the improved QuickBundles clustering algorithm for ship trajectory, in this paper, we compare and analyze the clustering effect and execution efficiency of the improved QuickBundles clustering algorithm, the QuickBundles clustering algorithm, and the DBSCAN algorithm.In the experiment, the thresholds of the three clustering algorithms are the best clustering thresholds obtained in Section 3.1.
The comparison results of the contour coefficients of the three clustering algorithms are shown in Figure 15a.The contour coefficient of DBSCAN is 0.5568, the contour coefficient of the QuickBundles clustering algorithm is 0.6173, and the contour coefficient of the improved QuickBundles clustering algorithm is 0.6380.The QuickBundle clustering algorithm surpasses the other two algorithms according to various metrics.Figure 16 shows the statistics of the three clustering algorithms.The distribution of contour coefficients of all trajectory data, the mean, upper quartile, median, and lower quartile of the improved QuickBundles clustering algorithm in the figure are higher than those of the QuickBundles clustering algorithm and the DBSCAN algorithm.The CHI comparison results of the three algorithms are shown in Figure 15b.The CHI of the improved QuickBundles clustering algorithm is 3769.2168,which is significantly higher than the other two comparison algorithms.Figure 15c shows the DBI comparison results of the three algorithms.For the ship trajectory data, the improved QuickBundles clustering algorithm is better than the other two algorithms.In terms of algorithm execution efficiency, as shown in Figure 15d, the improved QuickBundles clustering algorithm is only 305 milliseconds slower than the QuickBundles clustering algorithm, and the execution time of DBSCAN is less than 20.9 s.
The comparison results show that the QuickBundles clustering algorithm has improved the clustering effect of the DBSCAN ship trajectory clustering algorithm on the ship trajectory dataset.In terms of various indicators, the improved QuickBundles clustering algorithm has improved performance compared with the pre-improved QuickBundles algorithm and is more suitable for the clustering of ship trajectory data.In terms of algorithm execution efficiency, the improved sampling method does not significantly affect the algorithm.The improved QuickBundles algorithm is only 305 milliseconds slower than the QuickBundles algorithm, which is slower than DBSCAN's 20.9 s.The comparison results show that the QuickBundles clustering algorithm has improved the clustering effect of the DBSCAN ship trajectory clustering algorithm on the ship trajectory dataset.In terms of various indicators, the improved QuickBundles clustering algorithm has improved performance compared with the pre-improved QuickBundles algorithm and is more suitable for the clustering of ship trajectory data.In terms of algorithm execution efficiency, the improved sampling method does not significantly affect the algorithm.The improved QuickBundles algorithm is only 305 milliseconds slower than the QuickBundles algorithm, which is slower than DBSCAN's 20.9 s.The comparison results show that the QuickBundles clustering algorithm has improved the clustering effect of the DBSCAN ship trajectory clustering algorithm on the ship trajectory dataset.In terms of various indicators, the improved QuickBundles clustering algorithm has improved performance compared with the pre-improved QuickBundles algorithm and is more suitable for the clustering of ship trajectory data.In terms of algorithm execution efficiency, the improved sampling method does not significantly affect the algorithm.The improved QuickBundles algorithm is only 305 milliseconds slower than the QuickBundles algorithm, which is slower than DBSCAN's 20.9 s.In this section, we take the complete ship trajectories in complex waters as the research object, focusing on the characteristics of ship trajectories and headings in order to achieve fast and accurate clustering based on MDF distance and the QuickBundles clustering algorithm.A ship trajectory clustering method based on the improved QuickBundles algorithm is presented.In this section, first we compare the MDF distance with two classical trajectory metrics and analyze their advantages and disadvantages.We propose a sampling method based on the difference of the heading angle of the ship trajectory, improving the sampling method of the QuickBundles algorithm.Finally, a ship trajectory clustering experiment based on the improved QuickBundles algorithm is carried out, and the rationality and reliability of the research method presented in this section are analyzed by comparison with the DBSCAN algorithm on the public American coastal AIS ship trajectory dataset.
The experimental results show that the method proposed in this section can reasonably cluster the ship trajectories of various waterways and that the improved QuickBundles clustering algorithm has better clustering performance.In addition, using the dataset and without considering the trajectory noise, the improved QuickBundles clustering algorithm is slightly better than the traditional DBSCAN trajectory clustering algorithm in terms of accuracy and algorithm execution efficiency.The ship trajectory clustering results in this section will be used as the basis for subsequent ship trajectory anomaly detection research and ship trajectory classification research.

Ship Trajectory Classification Network Model Test Set Analysis
After the training of the ship trajectory classification network model, we use the test set to verify the model's channel trajectory classification effect.Table 6 is the confusion matrix of the classification results of the test set.Among them, the classification accuracy of the first, second, and third categories is 100%.Among the 334 samples of the fourth and fifth categories, there are six misidentified samples.Figure 17 is a comparison chart of the trajectories of the fourth and fifth types of ships in the water area where the experimental data are located.It can be seen that in the fourth and fifth types of ship trajectories, a very small part of the ships did not travel in the corresponding channel but sailed in the separation zone between the two channels, which violated the "General Provisions for Ship Routing System" and also led to misclassification of ship trajectories.In spite of this, the ship trajectory classification model presented in this paper still achieves an accuracy of 98.85% on the test set, achieving accurate classification of ship trajectory categories in the analyzed waters.

Cross-Validation Comparative Analysis
In order to further verify the classification ability of the ship trajectory classific network model, we select the fully connected neural network model and the multigory SVM model [33] with the longitude and latitude data format as input as a compa to carry out comparative analysis.The parameter information of the fully connected

Cross-Validation Comparative Analysis
In order to further verify the classification ability of the ship trajectory classification network model, we select the fully connected neural network model and the multi-category SVM model [33] with the longitude and latitude data format as input as a comparison to carry out comparative analysis.The parameter information of the fully connected neural network comparison model selected in this paper is shown in Table 7.Among them, the fully connected neural network requires a unified data input format, so in this paper, we draw on the method of Chen [34] and others; using cubic spline interpolation, each ship trajectory data are sampled as 50 points.The input data format of the fully connected neural network participating in the comparison is an array of 50 * 2, where 2 is the longitude and latitude of the ship's trajectory data, and 50 is the trajectory data length after sampling for each trajectory.The input data format of the SVM model participating in the comparison is an array of 100 * 1; 100 is the result of flattening the above 50 * 2 data, and the kernel function is RBF.All models have undergone 10-fold cross-validation.Figure 18 shows the results of the ten-fold crossvalidation of the three models, and Table 8 shows the average accuracy of the three models' 10-fold cross-validation.It can be seen from the experimental comparison results that for the dataset used in this paper, the proposed ship trajectory classification network model achieves 98.72% accuracy, which is higher than the 93.53% accuracy of the fully connected neural network model and the 91.73% accuracy of the SVM model.The superiority of the ship trajectory and waterway classification model in the performance of ship trajectory classification is verified.

Model
Average Accuracy Deep convolutional neural network(DCNN) 98.72%In this section, the ship trajectory classification research fails to use the ship trajectory spatial feature information, and the process of extracting features such as ship trajectory heading and speed is too cumbersome.We propose a ship trajectory classification method based on a deep convolutional neural network.First, based on the clustering results in Section 3, the trajectory longitude and latitude data are converted into high-dimensional trajectory image data, and the spatial characteristics of the ship trajectory are extracted.Then, the ship trajectory classification model is constructed based on the principle of a residual network [35], and ship trajectory classification is realized.Finally, using the latitude and longitude data of the ship trajectory as input, a fully connected neural network model and SVM model are constructed as comparison models, and a comparison experiment with the model proposed in this section is carried out.The experimental results show that for the dataset used in this article, the accuracy of this model on the test set is 98.85%, and the accuracy of the ten-fold cross-validation is 98.72%, which is higher than the 93.53% of the fully connected neural network and the 91.73% of the SVM.
According to the above comparison results, the ship trajectory is converted into image data while retaining its ability to express spatial features, simplifying the data feature extraction work and improving the efficiency of data processing.The deep convolutional neural network used to complete the trajectory classification task can make full use of the spatial characteristics of the trajectory data.Compared with the fully connected neural network model and the SVM model, the method proposed in this section has higher classification accuracy of the ship trajectory and provides support for the identification of the channel category.The research results of this section can provide auxiliary support for the intelligent decision making of the ship supervision department.The results of this study can provide support for the intelligent decision making for the ship navigation safety monitoring [36,37] department.

Conclusions
The main research work of this paper can be summarized by the following two points:

•
Aiming at the problem of invalid trajectories in the original ship trajectory data, a set of ship trajectory preprocessing methods based on time interval and speed changes are summarized.In order to improve the accuracy and execution efficiency of ship trajectory clustering, research on ship trajectory clustering based on MDF distance and QuickBundles clustering algorithm is carried out.Aiming at the problem that the sampling method of the QuickBundles algorithm does not consider the of local characteristics of ship trajectory, a new method is proposed.Considering the sampling method of heading, the QuickBundles clustering algorithm is improved, and the purpose is to analyze the characteristics of water traffic and ship motion in the water area.

•
In order to extract the spatial characteristics of the ship trajectory, complete the research of ship trajectory classification, convert the ship trajectory longitude and latitude data into ship trajectory image data, build a deep convolutional neural network ship trajectory classification model, and propose a deep convolution based on ship trajectory classification model, the neural network-based ship trajectory classification method analyzes the accuracy and reliability of the proposed method through real ship trajectory data and aims to solve the problem of classification of the waterway to which a ship's trajectory belongs.
Future research will be carried out considering the following directions: • In ship trajectory clustering research, the problem of ship trajectory clusters that contain a large amount of noise data has not been considered.In the future, it is necessary to conduct research on the noise characteristics of ship trajectory data to extract valuable ship trajectory information from it.

•
In this paper, we use deep convolutional neural networks to classify ship trajectories.
With the rapid development of graph neural networks, the next step can be to consider using graph neural networks to complete ship trajectory classification tasks and compare different algorithms.

Figure 1 .
Figure 1.The working process of the proposed methodology.

Figure 1 .
Figure 1.The working process of the proposed methodology.

Figure 2 .
Figure 2. Three different types of original and sampled trajectories.(a,b) the 20 ship trajectory points; (c) the ship in the original trajectory.

Figure 2 .
Figure 2. Three different types of original and sampled trajectories.(a,b) the 20 ship trajectory points; (c) the ship in the original trajectory.

Figure 6 .
Figure 6.Longitude and latitude information of the water area where the experimental data ar located.

Figure 6 .
Figure 6.Longitude and latitude information of the water area where the experimental data are located.

Figure 7 .
Figure 7. Schematic diagram of image pixels of latitude and longitude mapping.

Figure 7 .
Figure 7. Schematic diagram of image pixels of latitude and longitude mapping.

Figure 8 21 Figure 7 .
Figure8shows the ship trajectory image data after the latitude and longitude data of the ship trajectory are converted.According to the clustering results in Section 3, there are five types of ship trajectories in the waters where the experimental data are located based on the channel category division, so the label of the dataset is set to 0, 1, 2, 3, 4. The resolution of each ship trajectory image is 112 72, which corresponds to the latitude and longitude range of the water area.The specific dataset details, as well as the division of training set and test set are shown in Table3.

Figure 8 .
Figure 8. Trajectory image data display diagram.Figure 8. Trajectory image data display diagram.

Figure 8 .
Figure 8. Trajectory image data display diagram.Figure 8. Trajectory image data display diagram.

3. 1 . 3 .
Training Effect Analysis In this paper, we use the Tensorboard data analysis visualization tool in Tensorflow to analyze the model training effect.Figure 13 shows the change in loss value during the training process, with the number of iterations set to 20.With the increase in the number of iterations, the loss curve of the ship trajectory classification model shows a convergence trend as a whole, with a small fluctuation between the fourth and eighth iterations but finally converging around 0.04.The training results show that the model has learned the data features of the ship trajectory images and the model training has achieved the expected effect.Figure 14 is a graph of the accuracy rate of the validation set during the model training process.With the increase in training time, the accuracy rate of the model on the validation set classification increases rapidly.After the number of iterations reaches 10, the accuracy rate remains around 98.90%.This also shows that the model already has excellent classification ability for the training set.
is a graph of the accuracy rate of the validation set during model training process.With the increase in training time, the accuracy rate of the mo on the validation set classification increases rapidly.After the number of iterations reac 10, the accuracy rate remains around 98.90%.This also shows that the model already excellent classification ability for the training set.

Figure 15 .
Figure 15.Comparison of the clustering evaluation indicators of the three algorithms.

Figure 16 .
Figure 16.Box diagram of ship trajectory profile coefficients in the three algorithms.

Figure 15 .
Figure 15.Comparison of the clustering evaluation indicators of the three algorithms.

Figure 15 .
Figure 15.Comparison of the clustering evaluation indicators of the three algorithms.

Figure 16 .
Figure 16.Box diagram of ship trajectory profile coefficients in the three algorithms.Figure 16.Box diagram of ship trajectory profile coefficients in the three algorithms.

Figure 16 .
Figure 16.Box diagram of ship trajectory profile coefficients in the three algorithms.Figure 16.Box diagram of ship trajectory profile coefficients in the three algorithms.

.Figure 17 .
Figure 17.The fourth-and fifth-type channel information map of the water area where the ex mental data are located.

Figure 17 .
Figure 17.The fourth-and fifth-type channel information map of the water area where the experimental data are located.

Figure 18 .
Figure 18.Ten-fold cross-validation results of the three models.

Figure 18 .
Figure 18.Ten-fold cross-validation results of the three models.

Table 1 .
Division and filtering threshold settings.

Table 2 .
Division and filtering results.
J. Mar.Sci.Eng.2022, 10, x FOR PEER REVIEW 8 of 2 accidents.In this section, we use the trajectory clustering results as the training dataset t investigate the classification of ship trajectories and propose a ship trajectory classificatio method based on deep convolutional neural networks.2.2.1.Longitude and Latitude Mapping and Coordinate Conversion
technology.In this paper, we build a ship trajectory and channel classification model based on ResNet50 as a deep convolutional neural network framework.

Table 4 .
Ship trajectory classification network structure.

Table 4 .
Ship trajectory classification network structure.

Table 5 .
Hyperparameters.In this paper, we use Radam as the optimizer.Radam is a deep learning optimizer proposed by Chinese doctoral student Liu Yiyuan in 2019.

Table 6 .
Confusion matrix of ship trajectory image test set.

Table 7 .
Fully connected neural network model parameters.

Table 8 .
The age accuracy of the three models' ten-fold cross-validation.

Table 8 .
The age accuracy of the three models' ten-fold cross-validation.