A ship trajectory classification method and system based on CNN and LSTM neural network combination
Through the combined method of CNN and LSTM neural network, ship trajectory data is cleaned and feature extracted, which solves the problem of inaccurate ship trajectory classification in the existing technology and achieves higher classification accuracy and model promotion ability.
Patent Information
- Application Number
- CN202211100665.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-08
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2042-09-08
AI Technical Summary
Existing technology cannot achieve accurate classification of ship trajectories, and the classification model is difficult to generalize to different sea areas and environments.
The combined method of CNN and LSTM neural network is used to clean and preprocess the original trajectory data, calculate the motion attribute subsequence through the sliding window, and input it into the pre-built CNN-LSTM model for motion feature extraction and temporal feature extraction. , and finally classified through the trajectory type prediction module.
It improves the accuracy of ship trajectory classification and the generalization ability of the model, can more clearly reflect the timing information in the trajectory, and learn more accurate trajectory timing characteristics.
Smart Images

Figure CN115512152B
Abstract
Description
Technical Field
[0001] The invention relates to the field of geographic information technology, and in particular to a classification and identification method for spatiotemporal trajectory data, and in particular to a classification and identification method for ship navigation trajectories recorded by an AIS (Automatic Identification System). Background Art
[0002] With the increasing popularity of AIS (Automatic Identification System) related equipment on various types of ships, the ship trajectory information recorded by it has become an important spatiotemporal data resource. These trajectory data contain rich information on ship movement, and the related analysis and mining work is of great significance for maritime traffic management, navigation safety protection, marine pollution monitoring, etc. However, these analysis and mining work requires relevant basic algorithms as support. Among them, the classification and recognition of trajectory data is one of the basic algorithms. A typical scenario is that the type of ship that generates the trajectory may be missing a label in the original collected data, which makes it difficult to use trajectory data to carry out ship navigation supervision and abnormal behavior detection. Therefore, it is necessary to study special trajectory classification methods to identify different types of ship trajectories.
[0003] For the classification of ship trajectories, the models currently used include conditional random fields, decision trees, random forests, K-nearest neighbors (KNN), support vector machines, etc. However, the above machine learning methods rely on manually defined features as the input of the model, and the classification results are easily affected by subjective factors. At the same time, considering the different navigation rules and environmental characteristics of ships in different sea areas, different feature combinations and parameter settings are often required, which makes the constructed classification models difficult to promote in practical applications. Inspired by the great success of deep learning technology in speech recognition, text translation and other fields, in recent years, researchers have introduced convolutional neural networks (CNN) and long short-term memory (LSTM) neural networks to conduct research on spatiotemporal trajectory data. These methods are mainly used for trajectory position prediction, that is, using the historical trajectory data of the ship to predict the position of the ship at the next moment, which belongs to regression problems.
[0004] Therefore, the current method cannot achieve accurate classification of ship trajectories. Summary of the invention
[0005] The present invention provides a ship track classification method and system combining CNN and LSTM neural networks, which are used to solve or at least partially solve the technical problem of low accuracy of ship track classification in the prior art.
[0006] In order to solve the above technical problems, the first aspect of the present invention provides a ship trajectory classification method combining CNN and LSTM neural networks, comprising:
[0007] S1: Data cleaning and preprocessing of the original trajectory data to be classified;
[0008] S2: The trajectory data after data cleaning and preprocessing is represented by a trajectory sequence, and a fixed-size sliding window is used to calculate the motion attributes of the ship at each trajectory point along the trajectory sequence in turn, and a motion attribute subsequence of the ship along the trajectory line is obtained, wherein the motion attribute subsequence is set to a fixed length, and the motion attributes include motion speed, acceleration and heading change rate;
[0009] S3: The obtained motion attribute subsequence of the ship along the trajectory line is input into the pre-built CNN-LSTM model. The CNN-LSTM model includes a motion feature extraction module, a time series feature extraction module and a trajectory type prediction module. Among them, the motion feature extraction module extracts motion features of each motion attribute subsequence through multiple different CNNs respectively. The time series feature extraction module adopts the LSTM model. The extracted motion features are input into the LSTM model in time series to extract the corresponding time series features. Finally, the output of the LSTM model at each moment is combined through the trajectory type prediction module to obtain the trajectory prediction category result.
[0010] In one embodiment, step S1 includes:
[0011] S1.1: Eliminate the trajectory points that are missing the latitude and longitude coordinates and time information of the ship in the original trajectory data to be classified;
[0012] S1.2: Setting threshold T seg , if the time interval between adjacent trajectory points is greater than T seg , then the trajectory sequence is segmented at the corresponding trajectory points;
[0013] S1.3: Use a heuristic outlier trajectory point detection and elimination method to delete trajectory points with abnormal geometric positions, including: taking the current trajectory point p a As the center of the circle, draw a circular area with a radius of Max_sp×Δt, where Max_sp represents the maximum speed of the ship and Δt represents p a and the next trajectory point p a+1 time interval, if the trajectory point p a+1 If it is outside the circular area, then p a+1 Identify outlier trajectory points and remove them;
[0014] S1.4: A stop point detection algorithm with dual constraints of distribution density and range is used to identify the ship's stop trajectory points, specifically including: using a density clustering algorithm to cluster the sequence trajectory points with aggregation into clusters, and each cluster of trajectory points is used as a potential object of the stop point. Then, the distance between the geometric center of each cluster of trajectory points and the start and end trajectory points of the cluster time series is calculated. By setting the distance constraint threshold R, point clusters caused by low-speed driving or too small sampling interval are excluded. Finally, the retained trajectory point clusters are marked as stop points, and the trajectory point sequence is segmented in the stop point area.
[0015] In one embodiment, step S2 uses a sliding window of a fixed size to sequentially calculate the motion attributes of the ship at each track point along the track sequence, including:
[0016] Calculate the velocity and acceleration at each trajectory point:
[0017]
[0018]
[0019] Among them, the trajectory points contained in the sliding window are p i+1 ,…,p i+m , m represents the window size, that is, the number of trajectory points included, Dist(p i+1 ,p i+m ) represents the trajectory point p i+1 and p i+m The spherical distance between i Represents the trajectory point p i+1 and p i+m The time interval, Δt u Represents the current sliding window center point p u and the next sliding window center point p u+1 the time interval between
[0020] Calculate the heading change rate for each track point:
[0021]
[0022] in, and are trajectory points p i+1 and p i+m The longitude and latitude coordinates of Bearing(p u ) is the center point p of the current sliding window u The heading, that is, the true north direction and the vector The clockwise angle between the directions, Bearing(p u+1 ) is p u+1 The heading, t u For pu The moment, t u+1 For p u+1 moment.
[0023] In one embodiment, the processing of the motion feature extraction module includes:
[0024] The motion attribute subsequences are organized into multi-channel expressions, each channel represents a motion attribute, the channel size is 1×Len / p, and c out The size is c input ×1×h convolution kernel For input features Perform convolution calculations, use zero-value padding and a stride of 1 to keep the feature size unchanged after the convolution operation, and use the activation function to output it as a new feature. The new feature y generated by each convolution kernel is i The expression is:
[0025]
[0026] c out is the number of channels output after convolution operation, c input is the number of channels of the convolution input, w1, w2, The first, second, and channels, h is the width of the convolution kernel, 0≤i≤(Len / p), x i represents the value at the i-th position of the input vector x, f(·) represents the nonlinear activation function; b represents the bias vector; n represents the current number of channels. After calculation through a convolution kernel, the new feature vector generated is Y={y1,y2,…,y Len / p};
[0027] Use pooling operation to obtain coarse-grained main features, and the feature Y in the pooling window k×s:k×s+l-1 The maximum value of is taken as the output, and the expression is:
[0028]
[0029] Among them, k represents the number of times the pooling window moves, floor(·) is the floor rounding function; l and s represent the window length and moving step, respectively;
[0030] The vector corresponding to the main features extracted by the pooling operation is flattened into a one-dimensional vector and input into the fully connected layer for feature dimensionality reduction. The feature vector after dimensionality reduction is used as the input of the subsequent time series feature extraction module.
[0031] In one embodiment, the processing of the temporal feature extraction module includes:
[0032] f t=σ(Wf gg t+W fh h t-1 +) (6)
[0033] i t =σ(W ig g t +W ih h t-1 +b i ) (7)
[0034] j t =tanh(W ig g t +W jh h t-1 +b j ) (8)
[0035] c t =f t ⊙c t-1 +i t ⊙j t (9)
[0036] o t =σ(W og g t +W oh h t-1 +b o ) (10)
[0037] h t =o t ⊙tanh(c t ) (11)
[0038] Among them, f t 、i t 、j t , o t are the output values of the forget gate, input gate, update gate, and output gate at time t respectively; g t is the feature vector at time t output by the motion feature extraction module, h t-1 is the hidden state at time t-1, c t-1 is the cell state at time t-1, ⊙ represents the dot multiplication operation; W fg , W fh They are respectively the forget gate and g t The weight matrix for matrix calculation and h t-1 The weight matrix for matrix calculation, b f is the bias vector of the forget gate, W ig , W ih are respectively the input gate and g t The weight matrix for matrix calculation and ht-1 The weight matrix for matrix calculation, b i is the bias vector of the input gate, W jg , W jh are respectively the update gate and g t The weight matrix for matrix calculation and h t-1 The weight matrix for matrix calculation, b j is the bias vector of the update gate, W og , W oh are the output gate and g t The weight matrix for matrix calculation and h t-1 The weight matrix for matrix calculation, b o is the bias vector of the output gate, σ and tanh represent the Sigmoid activation function and the tanh activation function respectively, and h t is the hidden state at time t, that is, the output at time t.
[0039] In one embodiment, the processing of the trajectory type prediction module includes:
[0040] The feature vector h1,h2,…,h output by the LSTM network at each time step p After the combination, it is input into the multi-layer perceptron for processing, and the output is a one-dimensional array of length n′, where n′ is equal to the number of ship trajectory types and p is the total number of feature vectors;
[0041] For each output value z i′ Use Softmax function for activation processing, 1≤i′≤n′, the expression is:
[0042]
[0043] Among them, P i′ is the probability value of the ship trajectory belonging to the i'th type, and The type with the largest probability value is the predicted category of the corresponding ship trajectory, and b is a count value from 1 to n′.
[0044] Based on the same inventive concept, the second aspect of the present invention provides a ship trajectory classification system combining CNN and LSTM neural networks, comprising:
[0045] The preprocessing module is used to clean and preprocess the raw trajectory data to be classified;
[0046] The subsequence acquisition module is used to represent the trajectory data after data cleaning and preprocessing with a trajectory sequence, and use a fixed-size sliding window to calculate the motion attributes of the ship at each trajectory point along the trajectory sequence in turn, and obtain the motion attribute subsequence of the ship along the trajectory line, wherein the motion attribute subsequence is set to a fixed length, and the motion attributes include motion speed, acceleration and heading change rate;
[0047] The trajectory classification module is used to input the obtained motion attribute subsequence of the ship along the trajectory line into the pre-built CNN-LSTM model. The CNN-LSTM model includes a motion feature extraction module, a time series feature extraction module and a trajectory type prediction module. Among them, the motion feature extraction module extracts motion features of each motion attribute subsequence through multiple different CNNs, and the time series feature extraction module adopts the LSTM model. The extracted motion features are input into the LSTM model in time series to extract the corresponding time series features. Finally, the output of the LSTM model at each moment is combined through the trajectory type prediction module to obtain the trajectory prediction category result.
[0048] The ship trajectory classification method of a CNN and LSTM neural network combination provided by the present invention first performs data cleaning and preprocessing on the original trajectory data to be classified, then performs trajectory sequence representation, and uses a fixed-size sliding window to calculate the motion attributes of the ship at each trajectory point in sequence along the trajectory sequence. The trajectory sequence can be divided into different subsequences according to different motion attributes (motion speed, acceleration and heading change rate), and then each subsequence is input into a pre-constructed CNN-LSTM model. The motion feature extraction module extracts motion features of each motion attribute subsequence through multiple different CNNs, and the extracted motion features are input into the LSTM model in time sequence to extract the corresponding time sequence features. Finally, the output of the LSTM model at each moment is combined by the trajectory type prediction module to obtain the trajectory prediction category result. The CNN-LSTM model respectively utilizes the advantages of CNN and LSTM neural networks in extracting high-level motion features of local trajectory points and analyzing the correlation relationship of trajectory information in different time periods, and improves the classification accuracy by combining and using two neural networks of different properties. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0050] Figure 1 This is a framework diagram of a ship trajectory classification method in an embodiment of the present invention;
[0051] Figure 2 is a schematic diagram of an outlier trajectory point detection method in an embodiment of the present invention;
[0052] Figure 3 is a schematic diagram of stop trajectory point detection based on density features and range constraints in an embodiment of the present invention;
[0053] Figure 4 : is a structural diagram of a CNN-LSTM model for ship trajectory classification in an embodiment of the present invention;
[0054] Figure 5 It is a CNN network structure diagram in an embodiment of the present invention;
[0055] Figure 6 1 is a diagram showing the internal structure of an LSTM cell unit in an embodiment of the present invention. DETAILED DESCRIPTION
[0056] The inventors of this application have found through extensive research and practice that for the classification of ship trajectories, it is necessary to comprehensively consider the spatial distribution pattern of trajectory sampling points, the implicit motion characteristics of trajectory points at different times (such as speed, acceleration, turning rate, etc.), and the changing characteristics of motion behavior in time series. Inspired by the great success of deep learning technology in the fields of speech recognition and text translation, researchers have introduced convolutional neural networks (CNN) and long short-term memory (LSTM) neural networks in recent years to conduct research on spatiotemporal trajectory data. However, current research is mainly used for the prediction of trajectory positions, and there is no relevant research on the classification of trajectory data. Based on this, the present invention proposes a ship trajectory classification method combining CNN and LSTM neural networks. The main differences between this method and the trajectory position prediction method in the prior art include:
[0057] (1) Different task objectives: The prior art method is trajectory position prediction, which is a regression problem; the present invention is trajectory type recognition, which is a classification problem.
[0058] (2) Due to different task objectives, the features are processed and the loss is calculated differently. The related method for predicting trajectory position is to use the output of the LSTM network at the last moment to predict the trajectory and calculate the MSE loss; the task of this application is trajectory classification, which will combine the output of the LSTM network at each moment, and calculate the probability of the trajectory belonging to each trajectory category through the Softmax function, and take the category corresponding to the maximum probability value as the final prediction category. Similarly, the output of each moment will be combined to calculate the cross entropy loss to adjust the model.
[0059] (3) CNN and LSTM are combined in different ways. The method for predicting the trajectory position is to input the entire trajectory into CNN for motion feature extraction, and then input the output vector of CNN into LSTM; the present application first divides the trajectory segment into subsequences of equal length according to time sequence and motion attributes, and respectively inputs CNN modules with different convolution kernels to extract the motion features of each sequence, and then inputs the extracted motion features into LSTM in time sequence. The neural network combination method of the present invention can more clearly and explicitly reflect the temporal information contained in the input trajectory, and the trained model can learn more accurate trajectory temporal features.
[0060] (4) The data preprocessing method of the present application has been improved, including outlier detection and processing, stop point detection and processing, etc., so that the trajectory can be better segmented into a trajectory sequence rich in semantic information.
[0061] In the method of the present invention, the high-level features implied by the neighboring trajectory information can be effectively extracted through the CNN model, providing a basis for the identification of the local area motion behavior of the moving target. As a typical time series data, the spatiotemporal trajectory of the ship can better take into account the correlation between the trajectory information at different times, and has advantages in detecting changes in the characteristics of the ship's mobile behavior.
[0062] In summary, CNN and LSTM are two types of deep learning technologies that have their own advantages in feature analysis and recognition of spatiotemporal trajectory data. Currently, there is no relevant research that combines the two types of deep learning models for classification and recognition of ship trajectories.
[0063] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0064] Embodiment 1
[0065] The embodiment of the present invention provides a ship trajectory classification method combining CNN and LSTM neural networks, including:
[0066] S1: Data cleaning and preprocessing of the original trajectory data to be classified;
[0067] S2: The trajectory data after data cleaning and preprocessing is represented by a trajectory sequence, and a fixed-size sliding window is used to calculate the motion attributes of the ship at each trajectory point along the trajectory sequence in turn, and a motion attribute subsequence of the ship along the trajectory line is obtained, wherein the motion attribute subsequence is set to a fixed length, and the motion attributes include motion speed, acceleration and heading change rate;
[0068] S3: The obtained motion attribute subsequence of the ship along the trajectory line is input into the pre-built CNN-LSTM model. The CNN-LSTM model includes a motion feature extraction module, a time series feature extraction module and a trajectory type prediction module. Among them, the motion feature extraction module extracts motion features of each motion attribute subsequence through multiple different CNNs respectively. The time series feature extraction module adopts the LSTM model. The extracted motion features are input into the LSTM model in time series to extract the corresponding time series features. Finally, the output of the LSTM model at each moment is combined through the trajectory type prediction module to obtain the trajectory prediction category result.
[0069] See also Figure 1 , is a framework diagram of the ship trajectory classification method in an embodiment of the present invention.
[0070] The original trajectory data is cleaned and preprocessed. Secondly, a fixed-size sliding window is used to calculate the motion attributes of the ship at each trajectory point along the trajectory sequence, and the ship's motion attribute sequence is constructed. Finally, the ship's motion attribute sequence is used as input, and a model combining CNN and LSTM (referred to as CNN-LSTM model) is used to extract high-level motion behavior features and identify trajectory types. The CNN-LSTM model consists of three parts: (1) motion feature extraction module, which uses CNN to extract high-level features of ship motion attributes in local areas; (2) time series feature extraction module, which inputs the high-level features extracted by CNN into the LSTM network in time sequence to further obtain the behavioral feature changes of the ship's motion process; (3) trajectory type prediction module, which further processes the output results of the LSTM network through a multi-layer perceptron and a Softmax function, and finally outputs the trajectory type prediction results. Focusing on the difficult problem of ship trajectory data classification, the present invention proposes a classification method combining CNN-LSTM according to the advantages of two different types of neural networks, CNN and LSTM, in extracting high-level motion features of local trajectory points and analyzing the correlation relationship of trajectory information in different time periods, so as to mine the ship motion features in spatiotemporal trajectory data and achieve the goal of improving the accuracy of ship trajectory classification.
[0071] Specifically, data cleaning and preprocessing include missing attribute information processing of trajectory points, missing space-time area processing, outlier detection and processing, stop point detection and processing, etc.
[0072] Step S2 mainly describes and calculates the ship motion attributes. Specifically, after completing the data cleaning work, each trajectory sequence is organized into T = {p i ; i=1,…,n}(n≥2), p i Represents a trajectory point. and Represent the trajectory point p i The longitude and latitude coordinates, t i Represents the trajectory point p i The time information of the ship is obtained. Furthermore, a fixed-size sliding window is used to calculate the motion attributes (including motion speed, acceleration, and turning rate) of the ship at each trajectory point along the trajectory sequence, and the motion attribute sequence of the ship along the trajectory line is obtained. Considering the unified requirements of the subsequent model for input data, the threshold Len is set as the fixed length of the motion attribute sequence. If the actual motion attribute sequence length is greater than Len, segmentation is performed; otherwise, zero values are added to the end of the sequence until the length is Len.
[0073] After step S2, the divided motion attribute subsequences contain not only the motion attribute information but also the time information of the trajectory points, so as to prepare for subsequent data processing.
[0074] Step S3 uses the CNN-LSTM model to predict the trajectory category. After the trajectory segment is divided into subsequences of equal length (motion attribute subsequences) in chronological order, the CNN modules with different convolution kernels are respectively input to extract the motion features of each sequence. Then, the extracted motion features are input into the LSTM in time sequence to extract the time series features, which can more clearly reflect the time series information contained in the input trajectory. Finally, the output of each moment of the LSTM is combined and processed by the multi-layer perceptron and the Softmax function to obtain the prediction result.
[0075] In one embodiment, step S1 includes:
[0076] S1.1: Eliminate the trajectory points that are missing the latitude and longitude coordinates and time information of the ship in the original trajectory data to be classified;
[0077] S1.2: Setting threshold T seg , if the time interval between adjacent trajectory points is greater than T seg , then the trajectory sequence is segmented at the corresponding trajectory points;
[0078] S1.3: Use a heuristic outlier trajectory point detection and elimination method to delete trajectory points with abnormal geometric positions, including: taking the current trajectory point p a As the center of the circle, draw a circular area with a radius of Max_sp×Δt, where Max_sp represents the maximum speed of the ship and Δt represents pa and the next trajectory point p a+1 time interval, if the trajectory point p a+1 If it is outside the circular area, then p a+1 Identify outlier trajectory points and remove them;
[0079] S1.4: A stop point detection algorithm with dual constraints of distribution density and range is used to identify the ship's stop trajectory points, specifically including: using a density clustering algorithm to cluster the sequence trajectory points with aggregation into clusters, and each cluster of trajectory points is used as a potential object of the stop point. Then, the distance between the geometric center of each cluster of trajectory points and the start and end trajectory points of the cluster time series is calculated. By setting the distance constraint threshold R, point clusters caused by low-speed driving or too small sampling interval are excluded. Finally, the retained trajectory point clusters are marked as stop points, and the trajectory point sequence is segmented in the stop point area.
[0080] Specifically, this embodiment uses the ship trajectory data recorded by AIS, which is composed of a series of trajectory points at different times, and each trajectory point includes the latitude and longitude coordinates and time information of the ship's position. Since there may be many missing trajectory point attribute information, abnormal geometric positions, missing time and space regions, etc. in the original trajectory data, in order to discard useless data and facilitate subsequent data feature extraction, the original trajectory data needs to be cleaned and preprocessed first.
[0081] like Figure 2 , which is a schematic diagram of the heuristic outlier trajectory point detection and elimination method used in this embodiment.
[0082] The traditional method based on sequence trajectory point density analysis may lead to the misidentification of stop trajectory points, including trajectory points generated by ships traveling at low speed in a short period of time and trajectory points with too small local sampling intervals. To address this problem, this embodiment proposes a heuristic method for detecting and removing outlier trajectory points. Figure 3 shown.
[0083] In one embodiment, step S2 uses a sliding window of a fixed size to sequentially calculate the motion attributes of the ship at each track point along the track sequence, including:
[0084] Calculate the velocity and acceleration at each trajectory point:
[0085]
[0086]
[0087] Among them, the trajectory points contained in the sliding window are p i+1 ,…,p i+m , m represents the window size, that is, the number of trajectory points included, Dist(p i+1,p i+m ) represents the trajectory point p i+1 and p i+m The spherical distance between i Represents the trajectory point p i+1 and p i+m The time interval, Δt u Represents the current sliding window center point p u and the next sliding window center point p u+1 the time interval between
[0088] Calculate the heading change rate for each track point:
[0089]
[0090] in, and are trajectory points p i+1 and p i+m The longitude and latitude coordinates of Bearing(p u ) is the center point p of the current sliding window u The heading, that is, the true north direction and the vector The clockwise angle between the directions, Bearing(p u+1 ) is p u+1 The heading, t u For p u The moment, t u+1 For p u+1 moment.
[0091] Specifically, different types of ships have different dynamic characteristics when sailing, which are manifested in different speeds and accelerations of movement, different changes in heading, etc.
[0092] Define the heading change rate BR(p u ) describes the sliding window center point p u The heading change characteristics of Bearing(p u ) is calculated as follows:
[0093]
[0094] After using a sliding window to calculate the speed, acceleration, and heading change rate of the ship at different positions, the motion attribute subsequence of the ship along the trajectory is obtained. Considering that the subsequent classification model requires the input sequence to have the same length, the threshold Len is set as the fixed length of the motion attribute sequence. If the length of a sequence is greater than Len, it is segmented; otherwise, zero values are added to the end of the sequence until the length is Len.
[0095] In one embodiment, the processing of the motion feature extraction module includes:
[0096] The motion attribute subsequences are organized into multi-channel expressions, each channel represents a motion attribute, the channel size is 1×Len / p, and c out The size is c input ×1×h convolution kernel For input features Perform convolution calculations, use zero-value padding and a stride of 1 to keep the feature size unchanged after the convolution operation, and use the activation function to output it as a new feature. The new feature y generated by each convolution kernel is i The expression is:
[0097]
[0098] c out is the number of channels output after convolution operation, c input is the number of channels of the convolution input, w1, w2, The first, second, and channels, h is the width of the convolution kernel, 0≤i≤(Len / p), x i represents the value at the i-th position of the input vector x, f(·) represents the nonlinear activation function; b represents the bias vector; n represents the current number of channels. After calculation through a convolution kernel, the new feature vector generated is Y={y1,y2,…,y Len / p}, after passing through the entire convolution module, c should be obtained out Y; Len is the length of the motion attribute subsequence, and p is the number of motion attribute subsequences;
[0099] Use pooling operation to obtain coarse-grained main features, and the feature Y in the pooling window k×s:k×s+l-1 The maximum value of is taken as the output, and the expression is:
[0100]
[0101] Among them, k represents the number of times the pooling window moves, floor(·) is a floor rounding function; l and s represent the window length and the moving stride, respectively; j represents any value from 1 to l, which is used to indicate the position of the feature value in the pooling window;
[0102] The vector corresponding to the main features extracted by the pooling operation is flattened into a one-dimensional vector and input into the fully connected layer for feature dimensionality reduction. The feature vector after dimensionality reduction is used as the input of the subsequent time series feature extraction module.
[0103] Specifically, if Figure 4 As shown in the figure, the ship motion attribute sequence is normalized and divided into p subsequences, denoted as A1, A2, …, A pEach subsequence is input into the CNN model separately, and the high-level features of the subsequence are extracted through convolution operations.
[0104] The CNN module mainly includes convolution operations, pooling calculations, and dimensionality reduction operations of the fully connected layer. Figure 5 As shown in the figure. Based on the features calculated by the convolution operation, the pooling operation further obtains the coarse-grained main features (high-level features). Through the pooling operation, the parameters can be reduced while preventing overfitting. After obtaining the high-level features of the input vector through several convolution and pooling operations, the extracted features are flattened into a one-dimensional vector and input into the fully connected layer for feature dimensionality reduction, so that they can be used as the input of the LSTM network later.
[0105] In one embodiment, the processing of the temporal feature extraction module includes:
[0106] f t =σ(W fg g t +W fh h t-1 +) (6)
[0107] i t =σ(W ig g t +W ih h t-1 +b i ) (7)
[0108] j t =tanh(W jg g t +W jh h t-1 +b j ) (8)
[0109] c t =f t ⊙c t-1 +i t ⊙j t (9)
[0110] o t =σ(W og g t +W oh h t-1 +b o ) (10)
[0111] h t =o t ⊙tanh(c t ) (11)
[0112] Among them, f t 、it 、j t , o t are the output values of the forget gate, input gate, update gate, and output gate at time t respectively; g t is the feature vector at time t output by the motion feature extraction module, h t-1 is the hidden state at time t-1, c t-1 is the cell state at time t-1, ⊙ represents the dot multiplication operation; W fg , W fh They are respectively the forget gate and g t The weight matrix for matrix calculation and h t-1 The weight matrix for matrix calculation, b f is the bias vector of the forget gate, W ig , W ih are respectively the input gate and g t The weight matrix for matrix calculation and h t-1 The weight matrix for matrix calculation, b i is the bias vector of the input gate, W jg , W jh are respectively the update gate and g t The weight matrix for matrix calculation and h t-1 The weight matrix for matrix calculation, b j is the bias vector of the update gate, W og , W oh are the output gate and g t The weight matrix for matrix calculation and h t-1 The weight matrix for matrix calculation, b o is the bias vector of the output gate, σ and tanh represent the Sigmoid activation function and the tanh activation function respectively, and h t is the hidden state at time t, that is, the output at time t.
[0113] Specifically, suppose the features of the motion attribute subsequence extracted by the CNN model are g1, g2, …, g p ,These features are input into the LSTM network in time order to further extract the ,changing characteristics of motion features in time series.
[0114] like Figure 6 As shown, the feature vector g is input into the LSTM network in sequence t (t=1,2,…,p), the LSTM unit receives input g at time t t , and the hidden state h of the cell output at the previous moment t-1 and cell state c t-1 .
[0115] ① The forget gate reads the hidden state h of the previous moment t-1 and the current input g t , do a Sigmoid nonlinear mapping and output a vector f t The forget gate determines what information is discarded from the cell state. This is shown in Formula 6.
[0116] ②The input gate reads the hidden state h of the previous moment t-1 and the current input g t , first do a Sigmoid nonlinear mapping, output vector i t ; Then do a tanh nonlinear mapping and output vector j t The input gate determines what new information is stored in the cell state. This is shown in formulas 7 and 8.
[0117] ③Use the vector f calculated by ① and ② t 、i t and j t , the cell state c at the previous moment t-1 Updated to c t The details are shown in Formula 9.
[0118] ④Finally, the output gate determines the output value of the unit, as shown in formulas 10 and 11.
[0119] In one embodiment, the processing of the trajectory type prediction module includes:
[0120] The feature vector h1,h2,…,h output by the LSTM network at each time step p After the combination, it is input into the multi-layer perceptron for processing, and the output is a one-dimensional array of length n′, where n′ is equal to the number of ship trajectory types and p is the total number of feature vectors;
[0121] For each output value z i′ Use Softmax function for activation processing, 1≤i′≤n′, the expression is:
[0122]
[0123] Among them, P i′ is the probability value of the ship trajectory belonging to the i'th type, and The type with the largest probability value is the predicted category of the corresponding ship trajectory, and b is a count value from 1 to n′.
[0124] Embodiment 2
[0125] Based on the same inventive concept, this embodiment provides a ship trajectory classification system combining CNN and LSTM neural networks, including:
[0126] The preprocessing module is used to clean and preprocess the raw trajectory data to be classified;
[0127] The subsequence acquisition module is used to represent the trajectory data after data cleaning and preprocessing with a trajectory sequence, and use a fixed-size sliding window to calculate the motion attributes of the ship at each trajectory point along the trajectory sequence in turn, and obtain the motion attribute subsequence of the ship along the trajectory line, wherein the motion attribute subsequence is set to a fixed length, and the motion attributes include motion speed, acceleration and heading change rate;
[0128] The trajectory classification module is used to input the obtained motion attribute subsequence of the ship along the trajectory line into the pre-built CNN-LSTM model. The CNN-LSTM model includes a motion feature extraction module, a time series feature extraction module and a trajectory type prediction module. Among them, the motion feature extraction module extracts motion features of each motion attribute subsequence through multiple different CNNs, and the time series feature extraction module adopts the LSTM model. The extracted motion features are input into the LSTM model in time series to extract the corresponding time series features. Finally, the output of the LSTM model at each moment is combined through the trajectory type prediction module to obtain the trajectory prediction category result.
[0129] It should be understood that parts not elaborated in detail in this specification belong to the prior art.
[0130] It should be understood that the above description of the preferred embodiment is relatively detailed and cannot be regarded as limiting the scope of patent protection of the present invention. Under the enlightenment of the present invention, ordinary technicians in this field can also make substitutions or modifications without departing from the scope of protection of the claims of the present invention, which all fall within the scope of protection of the present invention. The scope of protection requested for the present invention shall be based on the attached claims.
Claims
1. A ship trajectory classification method combining CNN and LSTM neural networks, characterized in that: include: S1: Data cleaning and preprocessing of the original trajectory data to be classified; S2: The trajectory data after data cleaning and preprocessing is represented by a trajectory sequence, and a fixed-size sliding window is used to calculate the motion attributes of the ship at each trajectory point along the trajectory sequence in turn, and the motion attribute sequence of the ship along the trajectory line is obtained, wherein a threshold value Len is set as the fixed length of the motion attribute sequence. If the length of the actual motion attribute sequence is greater than Len, the actual motion attribute sequence is segmented; otherwise, a zero value is added to the tail of the actual motion attribute sequence until the length is Len. The motion attributes include motion speed, acceleration and heading change rate; S3: The obtained motion attribute subsequence of the ship along the trajectory is input into the pre-built CNN-LSTM model. The CNN-LSTM model includes a motion feature extraction module, a time series feature extraction module and a trajectory type prediction module. The motion attribute subsequence of the ship along the trajectory is obtained by dividing the motion attribute sequence in S2 into equal lengths in time order. The divided equal-length motion attribute subsequences are respectively input into CNN modules with different convolution kernels, and high-level features are obtained through convolution and pooling operations. The time series feature extraction module adopts the LSTM model, and the extracted motion features are input into the LSTM model in time sequence to extract the corresponding time series features. Finally, the output of the LSTM model at each moment is combined through the trajectory type prediction module to obtain the trajectory prediction category result; Step S1 includes: S1.1: Eliminate the trajectory points that are missing the latitude and longitude coordinates and time information of the ship in the original trajectory data to be classified; S1.2: Setting threshold T seg , if the time interval between adjacent trajectory points is greater than T seg , then the trajectory sequence is segmented at the corresponding trajectory points; S1.3: Use a heuristic outlier trajectory point detection and elimination method to delete trajectory points with abnormal geometric positions, including: taking the current trajectory point p a As the center of the circle, draw a circular area with a radius of Max_sp×Δt, where Max_sp represents the maximum speed of the ship and Δt represents p a and the next trajectory point p a+1 time interval, if the trajectory point p a+1 If it is outside the circular area, then p a+1 Identify outlier trajectory points and remove them; S1.4: A stop point detection algorithm with dual constraints of distribution density and range is used to identify the ship's stop track points, specifically including: using a density clustering algorithm to cluster the sequence track points with clustering into clusters, each cluster of track points is used as a potential object of the stop point, and then calculating the distance between the geometric center of each cluster of track points and the start and end track points of the cluster time series, and by setting the distance constraint threshold R, excluding point clusters caused by low-speed driving or too small sampling interval, and finally, marking the retained track point clusters as stop points, and segmenting the track point sequence in the stop point area; The processing of the motion feature extraction module includes: The motion attribute subsequences are organized into multi-channel expressions, each channel represents a motion attribute, the channel size is 1×Len / p, and c out The size is c input ×1×h convolution kernel For input features Perform convolution calculations, use zero-value padding and a stride of 1 to keep the feature size unchanged after the convolution operation, and use the activation function to output it as a new feature. The new feature y generated by each convolution kernel is i The expression is: c out is the number of channels output after convolution operation, c input is the number of channels of the convolution input, w1, w2, The first, second, and channels, h is the width of the convolution kernel, 0≤i≤(Len / p), x i represents the value at the i-th position of the input vector x, f(·) represents the nonlinear activation function; b represents the bias vector; n represents the current number of channels. After calculation through a convolution kernel, the new feature vector generated is Y={y1,y2,…,y Len / p }; Use pooling operation to obtain coarse-grained main features, and the feature Y in the pooling window k×s:k×s+l-1 The maximum value of is taken as the output, and the expression is: Among them, k represents the number of times the pooling window moves, floor(·) is the floor rounding function; l and s represent the window length and moving step, respectively; The vector corresponding to the main features extracted by the pooling operation is flattened into a one-dimensional vector and input into the fully connected layer for feature dimensionality reduction. The feature vector after dimensionality reduction is used as the input of the subsequent time series feature extraction module.
2. The ship trajectory classification method using a CNN and LSTM neural network combination as claimed in claim 1, characterized in that: Step S2 uses a sliding window of a fixed size to calculate the motion attributes of the ship at each track point along the track sequence, including: Calculate the velocity and acceleration at each trajectory point: Among them, the trajectory points contained in the sliding window are p i+1 ,…,p i+m , m represents the window size, that is, the number of trajectory points included, Dist(p i+1 ,p i+m ) represents the trajectory point p i+1 and p i+m The spherical distance between i represents the trajectory point p i+1 and p i+m The time interval, Δt u Represents the current sliding window center point p u and the next sliding window center point p u+1 the time interval between Calculate the heading change rate for each track point: in, and are trajectory points p i+1 and p i+m The longitude and latitude coordinates of Bearing(p u ) is the center point p of the current sliding window u The heading, that is, the true north direction and the vector The clockwise angle between the directions, Bearing(p u+1 ) is p u+1 The heading, t u For p u The moment, t u+1 For p u+1 moment.
3. The ship trajectory classification method of the CNN and LSTM neural network combination as claimed in claim 1, characterized in that: The processing of the time series feature extraction module includes: f t =σ(W fg g t +W fh h t-1 +b f ) (6) i t =σ(W ig g t +W ih h t-1 +b i ) (7) j t =tanh(W jg g t +W jh h t-1 +b j ) (8) c t =f t ⊙c t-1 +i t ⊙j t (9) o t =σ(W og g t +W oh h t-1 +b o ) (10) h t =o t ⊙tanh(c t ) (11) Among them, f t 、i t 、j t , o t are the output values of the forget gate, input gate, update gate, and output gate at time t respectively; g t is the feature vector at time t output by the motion feature extraction module, h t-1 is the hidden state at time t-1, c t-1 is the cell state at time t-1, ⊙ represents the dot multiplication operation; W fg , W fh They are respectively the forget gate and g t The weight matrix for matrix calculation and h t-1 The weight matrix for matrix calculation, b f is the bias vector of the forget gate, W ig , W ih are respectively the input gate and g t The weight matrix for matrix calculation and h t-1 The weight matrix for matrix calculation, b i is the bias vector of the input gate, W jg , W jh are respectively the update gate and g t The weight matrix for matrix calculation and h t-1 The weight matrix for matrix calculation, b j is the bias vector of the update gate, W og , W oh are the output gate and g t The weight matrix for matrix calculation and h t-1 The weight matrix for matrix calculation, b o is the bias vector of the output gate, σ and tanh represent the Sigmoid activation function and the tanh activation function respectively, and h t is the hidden state at time t, that is, the output at time t.
4. The ship trajectory classification method of the CNN and LSTM neural network combination as claimed in claim 1, characterized in that: The processing of the trajectory type prediction module includes: The feature vector h1,h2,…,h output by the LSTM network at each time step p After the combination, it is input into the multi-layer perceptron for processing, and the output is a one-dimensional array of length n′, where n′ is equal to the number of ship trajectory types and p is the total number of feature vectors; For each output value z i′ Use Softmax function for activation processing, 1≤i′≤n′, the expression is: Among them, P i′ is the probability value of the ship trajectory belonging to the i'th type, and The type with the largest probability value is the predicted category of the corresponding ship trajectory, and b is a count value from 1 to n′.
5. A ship trajectory classification system combining CNN and LSTM neural networks, characterized in that: include: The preprocessing module is used to clean and preprocess the raw trajectory data to be classified; The sequence acquisition module is used to represent the trajectory data after data cleaning and preprocessing with a trajectory sequence, and use a fixed-size sliding window to calculate the motion attributes of the ship at each trajectory point along the trajectory sequence in turn, and obtain the motion attribute sequence of the ship along the trajectory line, wherein a threshold value Len is set as the fixed length of the motion attribute sequence. If the length of the actual motion attribute sequence is greater than Len, the actual motion attribute sequence is segmented; otherwise, a zero value is added to the tail of the actual motion attribute sequence until the length is Len, and the motion attributes include motion speed, acceleration and heading change rate; The trajectory classification module is used to input the obtained motion attribute subsequence of the ship along the trajectory into a pre-built CNN-LSTM model. The CNN-LSTM model includes a motion feature extraction module, a time series feature extraction module and a trajectory type prediction module. The motion attribute subsequence of the ship along the trajectory is obtained by dividing the motion attribute sequence in the sequence acquisition module into equal lengths in time sequence. The divided equal-length motion attribute subsequences are respectively input into CNN modules with different convolution kernels, and high-level features are obtained through convolution and pooling operations. The time series feature extraction module adopts an LSTM model, and the extracted motion features are input into the LSTM model in time sequence to extract the corresponding time series features. Finally, the output of the LSTM model at each moment is combined through the trajectory type prediction module to obtain the trajectory prediction category result; The preprocessing module is specifically used to perform the following steps: S1.1: Eliminate the trajectory points that are missing the latitude and longitude coordinates and time information of the ship in the original trajectory data to be classified; S1.2: Setting threshold T seg , if the time interval between adjacent trajectory points is greater than T seg , then the trajectory sequence is segmented at the corresponding trajectory points; S1.3: Use a heuristic outlier trajectory point detection and elimination method to delete trajectory points with abnormal geometric positions, including: taking the current trajectory point p a As the center of the circle, draw a circular area with a radius of Max_sp×Δt, where Max_sp represents the maximum speed of the ship and Δt represents p a and the next trajectory point p a+1 time interval, if the trajectory point p a+1 If it is outside the circular area, then p a+1 Identify outlier trajectory points and remove them; S1.4: A stop point detection algorithm with dual constraints of distribution density and range is used to identify the ship's stop track points, specifically including: using a density clustering algorithm to cluster the sequence track points with clustering into clusters, each cluster of track points is used as a potential object of the stop point, and then calculating the distance between the geometric center of each cluster of track points and the start and end track points of the cluster time series, and by setting the distance constraint threshold R, excluding point clusters caused by low-speed driving or too small sampling interval, and finally, marking the retained track point clusters as stop points, and segmenting the track point sequence in the stop point area; The processing of the motion feature extraction module includes: The motion attribute subsequences are organized into multi-channel expressions, each channel represents a motion attribute, the channel size is 1×Len / p, and c out The size is c input ×1×h convolution kernel For input features Perform convolution calculations, use zero-value padding and a stride of 1 to keep the feature size unchanged after the convolution operation, and use the activation function to output it as a new feature. The new feature y generated by each convolution kernel is i The expression is: c out is the number of channels output after convolution operation, c input is the number of channels of the convolution input, w1, w2, The first, second, and channels, h is the width of the convolution kernel, 0≤i≤(Len / p), x i represents the value at the i-th position of the input vector x, f(·) represents the nonlinear activation function; b represents the bias vector; n represents the current number of channels. After calculation through a convolution kernel, the new feature vector generated is Y={y1,y2,…,y Len / p }; Use pooling operation to obtain coarse-grained main features, and the feature Y in the pooling window k×s:k×s+l-1 The maximum value of is taken as the output, and the expression is: Among them, k represents the number of times the pooling window moves, floor(·) is the floor rounding function; l and s represent the window length and moving step, respectively; The vector corresponding to the main features extracted by the pooling operation is flattened into a one-dimensional vector and input into the fully connected layer for feature dimensionality reduction. The feature vector after dimensionality reduction is used as the input of the subsequent time series feature extraction module.
