A ship classification and recognition method and device based on GNN
Through a GNN-based method, the ship AIS data is converted into graph structure data and trained using graph convolutional layer, which solves the problem of failing to effectively utilize data connections in traditional technology and improves the accuracy of ship classification recognition.
Patent Information
- Application Number
- CN202110766734.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-07
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2041-07-07
AI Technical Summary
The prior art fails to effectively utilize the connection between data in ship classification identification, resulting in unsatisfactory classification results.
Using Graph Neural Networks (GNN)-based method, a three-dimensional matrix sample total set is constructed by extracting the features of ship AIS data, and transforming it into graph structure data. The GNN network model with two-layer graph convolutional layer is trained and classified. .
By effectively utilizing the temporal and spatial domain characteristics and connection relationships in the ship trajectory, the accuracy of ship classification recognition is improved, and the shortcomings of traditional neural networks in processing non-Euclidean structural data are overcome.
Smart Images

Figure CN113569921B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of pattern recognition, and in particular to a GNN-based ship classification and recognition method and device. Background Art
[0002] Ship classification is widely used in both military and civilian fields, such as relevant departments detecting illegal ships, being vigilant against maritime terrorism, and combating smuggling. At present, the methods for studying ship type classification at home and abroad are mainly based on traditional radar identification and optical identification, but both have their limitations. For example, optical identification relies on video surveillance equipment, which has a limited field of view, a short range of action, and is easily affected by meteorological factors such as rain and fog, especially under meteorological conditions such as high humidity and low clouds at sea. Although radar identification is less affected by the environment, it has the problem of "seeing but not distinguishing", and it is easy to generate co-frequency interference clutter in complex electromagnetic environments. The solution for ship classification and identification based on AIS is less affected by weather, can automatically identify the status of ships all day long, has high data collection accuracy, and can collect static data such as voyages and ship attributes. Therefore, AIS is of great significance for ship classification and identification. However, the characteristics of AIS data, such as large data volume and wide coverage area, bring certain challenges to classification and identification.
[0003] Traditional research methods for ship classification mainly include clustering algorithms based on the distance between trajectory points, machine learning algorithms after manual feature extraction, and neural network classification methods. In recent years, compared with the method of combining manual feature extraction with machine learning, deep neural networks have gradually become a research hotspot. At present, the neural networks used for ship trajectory classification mainly include traditional recurrent neural networks and convolutional neural networks such as CNN, MCDCNN, 1DCNN and RNN. However, the data processed by convolutional neural networks are in matrix form, based on the matrix arranged by samples, and belong to the Euclidean structure. If the features of the samples are regarded as vertices, the vertices of traditional neural networks are independent and the connection between vertices is not utilized. The recurrent neural network is based on time series modeling, and its shortcomings are insufficient sample features and the inability to utilize the connection between the recommended features of different samples, resulting in incomplete feature learning and unsatisfactory classification results. Summary of the invention
[0004] In order to solve the above technical problems, the present invention proposes a GNN-based ship classification and identification method and device, which are used to solve the technical problem that the existing technology does not utilize the connection between data and the classification results are not ideal.
[0005] According to a first aspect of the present invention, a method for classifying and identifying ships based on GNN is provided, the method comprising the following steps:
[0006] Step S101: extracting features of ship AIS data, constructing a sample set, wherein the sample set is a three-dimensional matrix; converting the sample set into graph structure data, and dividing the sample set into a training set and a test set;
[0007] Step S102: training the GNN network model with the training set, inputting the features of the ship AIS data of all the samples to be tested in the test set into the trained GNN network model to test the effectiveness of the GNN network, and using the GNN network that has passed the test to classify the ships to be classified;
[0008] Each track is regarded as a sample, and the total set of samples is a three-dimensional matrix; the first dimension of the three-dimensional matrix is the number of tracks of the AIS data S={S1,…,S i , …, S num}; The second dimension is the trajectory S of the AIS data i The number of trajectory points N on the graph; the third dimension is the attributes of each trajectory point, including IMO, h, v, t-stamp, lat, and lon; among them, IMO is the ship IMO code, h is the bow feature, v is the speed, t-stamp is the timestamp, lat is the latitude value of the trajectory point, and lon is the longitude value of the trajectory point;
[0009] The sample set is converted into graph structure data G=(V, Edge), where V is a vertex and Edge is an edge connecting the vertices; the graph structure data uses the bow direction feature h of the trajectory point as the vertex feature to construct a vertex feature matrix M; the weights of the edges connecting the vertices are calculated according to the speed feature v to construct an adjacency matrix B;
[0010] The GNN network model is a GNN neural network model with two layers of graph convolution layers.
[0011] According to a second aspect of the present invention, a GNN-based ship classification and identification device is provided, the device comprising:
[0012] Feature acquisition module: configured to extract features of ship AIS data, construct a sample set, and the sample set is a three-dimensional matrix; convert the sample set into graph structure data, and divide the sample set into a training set and a test set;
[0013] Classification module: It is configured to train the GNN network model with the training set, input the features of the ship AIS data of all the samples to be tested in the test set into the trained GNN network model to test the effectiveness of the GNN network, and use the GNN network that has passed the test to classify the ships to be classified;
[0014] Each track is regarded as a sample, and the total set of samples is a three-dimensional matrix; the first dimension of the three-dimensional matrix is the number of tracks of the AIS data S={S1,…,Si , …, S num}; The second dimension is the trajectory S of the AIS data i The number of trajectory points N on the graph; the third dimension is the attributes of each trajectory point, including IMO, h, v, t-stamp, lat, and lon; among them, IMO is the ship IMO code, h is the bow feature, v is the speed, t-stamp is the timestamp, lat is the latitude value of the trajectory point, and lon is the longitude value of the trajectory point;
[0015] The sample set is converted into graph structure data G=(V, Edge), where V is a vertex and Edge is an edge connecting the vertices; the graph structure data uses the bow direction feature h of the trajectory point as the vertex feature to construct a vertex feature matrix M; the weights of the edges connecting the vertices are calculated according to the speed feature v to construct an adjacency matrix B;
[0016] The GNN network model is a GNN neural network model with two layers of graph convolution layers.
[0017] According to a third aspect of the present invention, a ship classification and identification system based on GNN is provided, comprising:
[0018] A processor, which is used to execute multiple instructions;
[0019] A memory for storing a plurality of instructions;
[0020] Among them, the multiple instructions are used to be stored by the memory, and loaded and executed by the processor to execute the GNN-based ship classification and recognition method as described above.
[0021] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein a plurality of instructions are stored in the storage medium; the plurality of instructions are used for a processor to load and execute the GNN-based ship classification and recognition method as described above.
[0022] According to the above scheme of the present invention, since the traditional neural network can only process neatly arranged Euclidean structures, it is impossible to effectively utilize the feature connections between different vertices, and the ship trajectory has spatiotemporal characteristics, and the sample characteristics belong to an irregularly arranged non-Euclidean structure. The present invention utilizes the spatiotemporal characteristics included in the ship trajectory, such as position characteristics, distance characteristics, speed characteristics, etc., to extract the connection relationship information between trajectory points and trajectory points, establish a topological association network, and effectively extract spatial features for machine learning. First, a mapping of trajectory point data and vertices and edges in the graph structure is constructed, key features of vertices are extracted, and the weights of edges are assigned to construct an adjacency matrix, and the trajectory point data is converted into a graph data structure, which is input into GNN for training to achieve classification and recognition of ship types. This method overcomes the above defects and can improve the accuracy of ship trajectory classification and recognition.
[0023] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention and implement it according to the contents of the specification, the following is a detailed description of the preferred embodiments of the present invention in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention, and the present invention is described by providing the following accompanying drawings. In the accompanying drawings:
[0025] Figure 1 It is a flow chart of the ship classification and identification method based on GNN of the present invention;
[0026] Figure 2 A schematic diagram of graph data according to an embodiment of the present invention;
[0027] Figure 3 A schematic diagram of the GNN network model structure of an embodiment of the present invention;
[0028] Figure 4 A schematic diagram of GNN network model training according to an embodiment of the present invention;
[0029] Figure 5 This is a structural block diagram of a GNN-based ship classification and identification device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] First combine Figure 1 The following describes a GNN-based ship classification and recognition method according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0031] Step S101: extracting features of ship AIS data, constructing a sample set, wherein the sample set is a three-dimensional matrix; converting the sample set into graph structure data, and dividing the sample set into a training set and a test set;
[0032] Step S102: training the GNN network model with the training set, inputting the features of the ship AIS data of all the samples to be tested in the test set into the trained GNN network model to test the effectiveness of the GNN network, and using the GNN network that has passed the test to classify the ships to be classified;
[0033] Each track is regarded as a sample, and the total set of samples is a three-dimensional matrix; the first dimension of the three-dimensional matrix is the number of tracks of the AIS data S={S1,…,S i , …, S num}; The second dimension is the trajectory S of the AIS data iThe number of trajectory points N on the graph; the third dimension is the attributes of each trajectory point, including IMO, h, v, t-stamp, lat, and lon; among them, IMO is the ship IMO code, h is the bow feature, v is the speed, t-stamp is the timestamp, lat is the latitude value of the trajectory point, and lon is the longitude value of the trajectory point;
[0034] The sample set is converted into graph structure data G=(V, Edge), where V is a vertex and Edge is an edge connecting the vertices; the graph structure data uses the bow direction feature h of the trajectory point as the vertex feature to construct a vertex feature matrix M; the weights of the edges connecting the vertices are calculated according to the speed feature v to construct an adjacency matrix B;
[0035] The GNN network model is a GNN neural network model with two layers of graph convolution layers.
[0036] Graph Neural Networks (GNN) is a deep learning model used to process graph data. It can effectively utilize the feature connections between different samples and is popular in social networks, knowledge graphs, molecular chemistry and other fields.
[0037] like Figure 2 As shown in the figure, a graph is composed of edges and vertices, where edges are represented by e and vertices by v. Each vertex in the graph contains its own features, which can be represented by an X×Y-dimensional matrix M. The edges represent the relationship between vertices, which can form an X×X-dimensional matrix B, called the adjacency matrix. M and B are the inputs of the graph neural network model.
[0038] Before step S101, step S100 is included;
[0039] The step S100: determining the ratio of the training set to the test set in the total sample set;
[0040] In this embodiment, the data ratio between the training set and the test set is 8:2. The training set is used to train the network model, and the test set is input into the network to classify the data to be tested.
[0041] The step S101: extracting features of ship AIS data, constructing a sample set, wherein the sample set is a three-dimensional matrix; converting the sample set into graph structure data, and dividing the sample set into a training set and a test set, including:
[0042] Ships with the same AIS data coded by IMO, with at least one track S i , each trajectory S i There are multiple trajectory points, each trajectory S i The trajectory points in are arranged in order of timestamps; from each trajectory Si Obtain N consecutive trajectory points that meet the preset rules; The trajectory S is composed of the N consecutive trajectory points i ', extract trajectory S i ', the attributes of each track point include IMO, h, v, t-stamp, lat, lon; where IMO is the ship IMO code, h is the heading, v is the speed, t-stamp is the timestamp, lat is the latitude value of the track point, and lon is the longitude value of the track point. Where 1≤i≤Num, Num is the total number of tracks with the same IMO. The features of the extracted AIS data are the three-dimensional matrix M Num*N*6 , extract features from all samples, construct a total sample set, and divide the sample set into a training set and a test set.
[0043] In this embodiment, the preset rule is: setting a predetermined time interval threshold, and the time interval between every two adjacent trajectory points in the N consecutive trajectory points is less than the predetermined time interval threshold.
[0044] Since the time interval for collecting AIS data in ports is irregular, some adjacent track points are separated by a few seconds, some by several minutes or even more than ten minutes. The longer the time interval for collecting data, the worse the sample quality. Therefore, it is necessary to select an appropriate and as small a time interval threshold TT (Time threshold) as possible to ensure data reliability. The number of track points N contained in the data segment determines the accuracy of classification and recognition. The more N, the higher the recognition accuracy. Therefore, it is necessary to select an appropriate and as many N as possible to ensure sample validity. Generally speaking, the larger the time interval threshold, the more track points in the sample segment, that is, sample reliability and validity are a pair of contradictions. Therefore, it is necessary to find a balance to make the sample have more N under the premise of a smaller TT. After testing, in this embodiment, after many experimental comparisons, the parameters TT = 20 (in seconds) are selected, and N = 160 can meet the requirements.
[0045] The ship feature data is converted into topological structure data, and the features are used to describe vertices and edges to construct an adjacency matrix. Only by selecting appropriate feature data as the input of the neural network can the effectiveness of ship trajectory classification be improved. In this embodiment, the adjacency matrix is constructed using the bow feature as the vertex feature and the speed feature as the edge weight.
[0046] In this embodiment, a trajectory is used as a sample, and a sample is converted into a vertex of the graph structure.
[0047] Converting the total sample set into graph structure data includes:
[0048] Step S1011: Determine the receptive field of the vertices in the graph structure, including:
[0049] Calculate the average Haugh distance between the samples to be tested
[0050]
[0051] in, The trajectory S i The nth trajectory point and trajectory S j The Haugh distance between the nth trajectory points in .
[0052] Sort the Haugh distances in ascending order, retain the top 5% of the data in the Haugh distance value to ensure a strong connection between vertices, and set a relationship strength threshold, for example, set the data that is exactly equal to the 5% as the relationship strength threshold. Represent strong connections with 1 and weak connections with 0, and construct a relationship matrix R based on the spatial distance connection strength feature to determine the receptive field of the vertex. The dimension of the relationship matrix I is X×X, where X represents the number of samples, that is, the number of vertices in the graph.
[0053]
[0054] Where Thr represents the relationship strength threshold, is the average Haugh distance between the samples to be tested.
[0055] In this embodiment, a point with a small Hatch distance indicates that the distance feature connection relationship between vertices is strong, and a point with a large Hatch distance indicates that the distance feature connection relationship between vertices is weak.
[0056] Step S1012: Calculate the bi-norm of the average speed difference between any two samples according to the average speed ave_v of all trajectory points in the sample, and use it as the weight of the edge in the graph structure to obtain a weight matrix E, whose dimension is X×X.
[0057]
[0058] in The trajectory S i The average speed of Represents the trajectory S j average speed.
[0059] Step S1013: Based on the weight matrix E, construct the adjacency matrix B:
[0060] Multiply the relationship matrix R based on the spatial distance connection strength feature by the edge weight matrix E to obtain the adjacency matrix B, whose dimension is X×X.
[0061] B=R·E
[0062] And normalize the adjacency matrix B:
[0063]
[0064] Where min(B) is the minimum value in the matrix B, max(B) is the maximum value in the matrix, and B(i,j) is the normalized adjacency matrix;
[0065] Step S1014: extract the bow direction features of the trajectory points as vertex features, and construct a vertex feature matrix M with a dimension of X×1.
[0066] The step S102: training the GNN network model with the training set, inputting the features of the ship AIS data of all the samples to be tested in the test set into the trained GNN network model to test the effectiveness of the GNN network, and classifying the ships to be classified using the GNN network that has passed the test, including:
[0067] The GNN network model is a GNN neural network model with two layers of graph convolutional layers, further:
[0068] The GNN network structure in this embodiment is as follows Figure 3 As shown in the figure, the dots represent the vertices of the graph with different labels. The input graph structure data passes through the GNN network structure and outputs classification results with different labels.
[0069] In this embodiment, the input-output relationship of the first graph convolution layer is:
[0070]
[0071] In the formula, h j is the eigenvalue of vertex j in the input data, h i is the eigenvalue of the output data vertex i, σ is the activation function, n j ∈Neigh(n i ) indicates that the value range of vertex j is the receptive field of vertex i, W 1τ is the convolution kernel of the first graph convolution layer, Normalize the Laplacian matrix:
[0072] LAPRAS[i,j]=A -1 / 2 B ij A 1 / 2
[0073] Where B = B + I, B is the normalized adjacency matrix, I is the identity matrix; A is the degree matrix of B, the formula is A ij =∑ j B ij .
[0074] The input-output relationship of the second graph convolution layer is:
[0075]
[0076] In the formula, h j is the eigenvalue of vertex j in the input data, h i is the eigenvalue of the output data vertex i, σ is the activation function, n j ∈Neigh(n i ) indicates that the value range of vertex j is the receptive field of vertex i, W 2τ is the convolution kernel of the second graph convolution layer, Normalize the Laplacian matrix;
[0077] LAPRAS[i,j]=A -1 / 2 B ij A 1 / 2
[0078] Where B = B + I, B is the normalized adjacency matrix, I is the identity matrix; A is the degree matrix of B, the formula is A ij =∑ j B ij .
[0079] is the normalized adjacency matrix added to the identity matrix, for The diagonal matrix formed by summing the elements of each column in , is the i-th row element of the diagonal matrix, represents the element in the i-th row and i-th column of a diagonal matrix, is the negative half power of a diagonal matrix, is a diagonal matrix raised to the power of one half.
[0080] like Figure 4 As shown, the training process of the GNN network model is:
[0081] Step S301: obtaining a training set from the total sample set, selecting AIS sample data of all types of ships in the training set, and extracting the features of the AIS data of each sample data;
[0082] In this embodiment, 80% of the total sample set is used as a training set, and 20% is used as a test set.
[0083] The extracting of the features of the AIS data of each sample data includes:
[0084] Ships with the same AIS data coded by IMO, with at least one track S i , each trajectory S i There are multiple trajectory points, each trajectory S i The trajectory points in are arranged in order of timestamps; from each trajectory S iObtain N consecutive trajectory points that meet the preset rules; The trajectory S is composed of the N consecutive trajectory points i ', extract trajectory S i ', the attributes of each track point include IMO, h, v, t-stamp, lat, lon; where IMO is the ship IMO code, h is the heading, v is the speed, t-stamp is the timestamp, lat is the latitude value of the track point, and lon is the longitude value of the track point. Where 1≤i≤Num, Num is the total number of tracks with the same IMO. The features of the extracted AIS data are the three-dimensional matrix M Num*N*6 .
[0085] Step S302: Input the features of the AIS data of each sample data in the training set into the GNN network until a preset condition for stopping training is met, thereby obtaining a trained GNN network;
[0086] Step S303: Input the features of the ship AIS data of all the samples to be tested in the test set into the trained GNN network model for vertex classification to test the effectiveness of the GNN network, and use the GNN network that has passed the test to classify the ships to be classified.
[0087] In this embodiment, the graph neural network training process is to train the convolution kernel.
[0088] Furthermore, before step S100, the ship AIS data is preprocessed, including:
[0089] Step S1: constructing a ship feature information table, including: constructing a ship feature database, extracting six fields, including IMO, timestamp, heading, speed, track point latitude, and track point longitude, from AIS data as values, and using the ship's IMO as the primary key value, that is, saving the track features of each ship according to the IMO number, and arranging the track point data of each IMO in the order of timestamp;
[0090] Step S2: Cleaning the ship AIS data, including:
[0091] After data analysis, dirty data that meets the data cleaning conditions is discarded. Dirty data includes abnormal position data and redundant position data. Abnormal position data refers to the distance difference between two adjacent trajectory point data being greater than a first preset distance threshold when the time interval is less than a first preset time interval, and redundant position data refers to the feature attributes of two adjacent trajectory point data being exactly the same.
[0092] The data analyzed and processed in this embodiment are ship trajectory data in a certain fixed sea area. In order to achieve an ideal classification effect, dirty data needs to be discarded.
[0093] The judgment strategy is:
[0094] 1. For data with the same key, calculate the time interval and distance interval between the i+1th trajectory point and the ith trajectory point. Considering the curvature of the earth, the distance calculation formula is the Haversine formula.
[0095]
[0096] The distance calculated using the Haversine formula is referred to as the Haugh distance.
[0097]
[0098] Where l is the distance between two trajectory points, R is the radius of the earth, which is generally 6371 km; lat1 Indicates the latitude of point x1, y lon1 indicates the longitude of point y1, x lat2 Indicates the latitude of point x2, y lon2 Represents the longitude of point y2, and φ is the input of the Haversine formula.
[0099] If the Haugh distance between two trajectory points in a short time interval is too large, the i+1th to nth trajectory points of the IMO ship are abnormal data and need to be discarded, where n represents the number of all trajectory points of the IMO ship in the same time window.
[0100] 2. If the i+1th trajectory point is exactly the same as the i-th trajectory point, the i+1th trajectory point is redundant data and needs to be discarded.
[0101] The embodiment of the present invention further provides a ship classification and identification device based on GNN, such as Figure 5 As shown, the device comprises:
[0102] Feature acquisition module: configured to extract features of ship AIS data, construct a sample set, and the sample set is a three-dimensional matrix; convert the sample set into graph structure data, and divide the sample set into a training set and a test set;
[0103] Classification module: It is configured to train the GNN network model with the training set, input the features of the ship AIS data of all the samples to be tested in the test set into the trained GNN network model to test the effectiveness of the GNN network, and use the GNN network that has passed the test to classify the ships to be classified;
[0104] Each track is regarded as a sample, and the total set of samples is a three-dimensional matrix; the first dimension of the three-dimensional matrix is the number of tracks of the AIS data S={S1,…,S i , …, S num}; The second dimension is the trajectory S of the AIS data iThe number of trajectory points N on the graph; the third dimension is the attributes of each trajectory point, including IMO, h, v, t-stamp, lat, and lon; among them, IMO is the ship IMO code, h is the bow feature, v is the speed, t-stamp is the timestamp, lat is the latitude value of the trajectory point, and lon is the longitude value of the trajectory point;
[0105] The sample set is converted into graph structure data G=(V, Edge), where V is a vertex and Edge is an edge connecting the vertices; the graph structure data uses the bow direction feature h of the trajectory point as the vertex feature to construct a vertex feature matrix M; the weights of the edges connecting the vertices are calculated according to the speed feature v to construct an adjacency matrix B;
[0106] The GNN network model is a GNN neural network model with two layers of graph convolution layers.
[0107] The embodiment of the present invention further provides a ship classification and identification system based on GNN, including:
[0108] A processor, which is used to execute multiple instructions;
[0109] A memory for storing a plurality of instructions;
[0110] Among them, the multiple instructions are used to be stored by the memory, and loaded and executed by the processor to execute the GNN-based ship classification and recognition method as described above.
[0111] An embodiment of the present invention further provides a computer-readable storage medium, in which a plurality of instructions are stored; the plurality of instructions are used by a processor to load and execute the GNN-based ship classification and recognition method as described above.
[0112] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0113] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0114] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0115] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0116] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a physical server, or a network cloud server, etc., which needs to be installed with Windows or Windows Server operating system) to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (RandomAccess Memory, RAM), disk or optical disk and other media that can store program codes.
[0117] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention still falls within the scope of the technical solution of the present invention.
Claims
1. A ship classification and recognition method based on GNN, characterized in that: The method comprises the following steps: Step S101: extracting features of ship AIS data, constructing a sample set, wherein the sample set is a three-dimensional matrix; converting the sample set into graph structure data, and dividing the sample set into a training set and a test set; Step S102: training the GNN network model with the training set, inputting the features of the ship AIS data of all the samples to be tested in the test set into the trained GNN network model to test the effectiveness of the GNN network, and using the GNN network that has passed the test to classify the ships to be classified; Each track is regarded as a sample, and the total set of samples is a three-dimensional matrix; the first dimension of the three-dimensional matrix is the number of tracks of the AIS data S={S1,…,S i , …, S num }; The second dimension is the trajectory S of the AIS data i The number of trajectory points N on the graph; the third dimension is the attributes of each trajectory point, including IMO, h, v, t-stamp, lat, and lon; among them, IMO is the ship IMO code, h is the bow feature, v is the speed, t-stamp is the timestamp, lat is the latitude value of the trajectory point, and lon is the longitude value of the trajectory point; The sample set is converted into graph structure data G=(V, Edge), where V is a vertex and Edge is an edge connecting the vertices; the graph structure data uses the bow direction feature h of the trajectory point as the vertex feature to construct a vertex feature matrix M; the weights of the edges connecting the vertices are calculated according to the speed feature v to construct an adjacency matrix B; The GNN network model is a GNN neural network model with two layers of graph convolutional layers; The converting the total sample set into graph structure data comprises: Step S1011: Determine the receptive field of the vertices in the graph structure, including: Calculate the average Haugh distance between the samples to be tested in, The trajectory S i The nth trajectory point and trajectory S j The Haugh distance between the nth trajectory points in ; Set a relationship strength threshold, sort the Haugh distances from small to large, and the distance characteristics between vertices whose Haugh distance is less than the relationship strength threshold indicate a strong connection relationship, and the distance characteristics between vertices whose Haugh distance is greater than the relationship strength threshold indicate a weak connection relationship; represent strong connections with 1, and weak connections with 0, and construct a relationship matrix R based on the spatial distance connection strength characteristics to determine the receptive field of the vertex; the dimension of the relationship matrix I is X×X, where X represents the number of samples, that is, the number of vertices in the graph: Where Thr represents the relationship strength threshold, is the average Haugh distance between the samples to be tested; Step S1012: Calculate the second norm of the average speed difference between any two samples to be tested according to the average speed ave_v of all trajectory points in the sample to be tested, and use it as the weight of the edge in the graph structure to obtain a weight matrix E, whose dimension is X×X. in The trajectory S i The average speed of Represents the trajectory S j average speed; Step S1013: Based on the weight matrix E, construct the adjacency matrix B: Multiply the relationship matrix R based on the spatial distance connection strength feature by the edge weight matrix E to obtain the adjacency matrix B, whose dimension is X×X. B=R·E And normalize the adjacency matrix B: Where min(B) is the minimum value in matrix B, and max(B) is the maximum value in the matrix. is the normalized adjacency matrix; Step S1014: extract the bow direction features of the trajectory points as vertex features, and construct a vertex feature matrix M with a dimension of X×1.
2. The ship classification and recognition method based on GNN according to claim 1, characterized in that: Before step S101, the ship AIS data is cleaned, including: Discard dirty data that meets the data cleaning conditions. Dirty data includes abnormal position data and redundant position data. Abnormal position data refers to the distance difference between two adjacent trajectory point data being greater than a first preset distance threshold when the time interval is less than a first preset time interval. Redundant position data refers to the fact that the characteristic attributes of two adjacent trajectory point data are exactly the same.
3. A ship classification and recognition device based on GNN, characterized in that: The device comprises: Feature acquisition module: configured to extract features of ship AIS data, construct a sample set, and the sample set is a three-dimensional matrix; convert the sample set into graph structure data, and divide the sample set into a training set and a test set; Classification module: It is configured to train the GNN network model with the training set, input the features of the ship AIS data of all the samples to be tested in the test set into the trained GNN network model to test the effectiveness of the GNN network, and use the GNN network that has passed the test to classify the ships to be classified; Each track is regarded as a sample, and the total set of samples is a three-dimensional matrix; the first dimension of the three-dimensional matrix is the number of tracks of the AIS data S={S1,…,S i , …, S num }; The second dimension is the trajectory S of the AIS data i The number of trajectory points N on the graph; the third dimension is the attributes of each trajectory point, including IMO, h, v, t-stamp, lat, and lon; among them, IMO is the ship IMO code, h is the bow feature, v is the speed, t-stamp is the timestamp, lat is the latitude value of the trajectory point, and lon is the longitude value of the trajectory point; The sample set is converted into graph structure data G=(V, Edge), where V is a vertex and Edge is an edge connecting the vertices; the graph structure data uses the bow direction feature h of the trajectory point as the vertex feature to construct a vertex feature matrix M; the weights of the edges connecting the vertices are calculated according to the speed feature v to construct an adjacency matrix B; The GNN network model is a GNN neural network model with two layers of graph convolution layers.
4. The GNN-based ship classification and identification device according to claim 3, characterized in that: The feature acquisition module comprises: Receptive field determination submodule: configured to determine the receptive field of vertices in the graph structure, including: Calculate the average Haugh distance between the samples to be tested in, The trajectory S i The nth trajectory point and trajectory S j The Haugh distance between the nth trajectory points in ; Set a relationship strength threshold, sort the Haugh distances from small to large, and the distance characteristics between vertices whose Haugh distance is less than the relationship strength threshold indicate a strong connection relationship, and the distance characteristics between vertices whose Haugh distance is greater than the relationship strength threshold indicate a weak connection relationship; represent strong connections with 1, and weak connections with 0, and construct a relationship matrix R based on the spatial distance connection strength characteristics to determine the receptive field of the vertex; the dimension of the relationship matrix I is X×X, where X represents the number of samples, that is, the number of vertices in the graph: Where Thr represents the relationship strength threshold, is the average Haugh distance between the samples to be tested; The weight matrix acquisition submodule is configured to calculate the bi-norm of the average speed difference between any two samples to be tested according to the average speed ave_v of all trajectory points in the sample to be tested, and use it as the weight of the edge in the graph structure to obtain the weight matrix E, whose dimension is X×X. in The trajectory S i The average speed of Represents the trajectory S j average speed; Adjacency matrix acquisition submodule: configured to construct the adjacency matrix B based on the weight matrix E: Multiply the relationship matrix R based on the spatial distance connection strength feature by the edge weight matrix E to obtain the adjacency matrix B, whose dimension is X×X. B=R·E And normalize the adjacency matrix B: Where min(B) is the minimum value in matrix B, and max(B) is the maximum value in the matrix. is the normalized adjacency matrix; Track point extraction submodule: It is configured to extract the bow direction features of the track points as vertex features and construct a vertex feature matrix M with a dimension of X×1.
5. The GNN-based ship classification and identification device according to claim 3 or 4, characterized in that: The device comprises: The data cleaning module is configured to discard dirty data that meets the data cleaning conditions, and the dirty data includes abnormal position data and redundant position data, wherein the abnormal position data refers to the distance difference between two adjacent trajectory point data being greater than a first preset distance threshold when the time interval is less than a first preset time interval, and the redundant position data refers to the feature attributes of two adjacent trajectory point data being exactly the same.
6. A ship classification and recognition system based on GNN, comprising: A processor, which is used to execute multiple instructions; A memory for storing a plurality of instructions; Wherein, the multiple instructions are used to be stored by the memory, and loaded and executed by the processor to implement the GNN-based ship classification and recognition method as described in any one of claims 1-2.
7. A computer-readable storage medium, wherein a plurality of instructions are stored in the storage medium; the plurality of instructions are used by a processor to load and execute the GNN-based ship classification and recognition method as described in any one of claims 1-2.
Citation Information
Patent Citations
Ship target recognition method based on transfer learning
CN109800796A
Ship identification method and system based on deep learning
CN110569844A