A method, device, electronic device and storage medium for predicting ship traffic flow

The ship trajectory data is repaired through a two-way long and short-term memory network, combining direction identification and density adaptive parameter node clustering, which solves the data integration problem in ship traffic flow prediction and improves the accuracy of prediction.

CN119989016BActive Publication Date: 2025-07-25WUHAN UNIV OF TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510459025.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-14
Publication Date
2025-07-25
Estimated Expiration
2045-04-14

AI Technical Summary

Technical Problem

The prior art is difficult to effectively integrate and utilize dynamic change information and deep relationships in complex and incomplete ship trajectory data, resulting in low accuracy in ship traffic flow prediction.

Method used

A two-way long and short-term memory network is used for trajectory prediction and repair, combining direction identification trajectory clustering and density adaptive parameter node clustering, and improving data integrity and accuracy through spatiotemporal feature extraction and prediction output.

Benefits of technology

Through the two-way trajectory prediction repair and clustering method, dynamic transformation information and deep relationships are retained, and the accuracy of ship traffic flow prediction is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119989016B_ABST
    Figure CN119989016B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device, electronic device and storage medium for predicting ship traffic flow, belonging to the field of maritime traffic management. The method includes: obtaining ship trajectory data of a port to be detected, and performing two-way trajectory prediction repair on the ship trajectory data to obtain repaired trajectory data; performing direction recognition trajectory clustering on the repaired trajectory data to obtain trajectory clustering data, and performing density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data; performing spatio-temporal feature extraction and prediction output on the node clustering data to obtain a ship traffic flow prediction result. The present invention ensures the integrity of ship trajectory data through two-way trajectory prediction repair, mines trajectory direction information while clustering through direction recognition trajectory clustering, and mines comprehensive node information while clustering through density adaptive parameter node clustering, can retain dynamic transformation information and deep relationships and effectively integrate the data, and improve the accuracy of ship traffic flow prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of maritime traffic management, and particularly to a method, device, electronic device and storage medium for predicting ship traffic flow. Background Art

[0002] In global trade, the shipping industry plays a crucial role, and more than 80% of international trade is completed by sea. With the continuous growth of the global port throughput, the increase in ship traffic flow poses severe challenges to water traffic management. Especially in narrow channels, busy anchorages and dock areas with frequent operations, the frequency of ship arrivals and departures is increasing continuously, and there are traffic jams and safety hazards. Therefore, the accuracy of effective prediction of ship traffic flow is crucial for port planning and water traffic safety. In the field of ship traffic flow prediction, AIS (Automatic Identification System) provides a large amount of ship trajectory data, which contains the time and space information of ship activities. By deeply analyzing the trajectory data provided by the AIS system, the laws of ship traffic activities can be mined, providing important references for water traffic management.

[0003] Currently, the existing ship traffic flow prediction extracts spatio-temporal features from AIS data through graph neural networks and conducts traffic flow prediction based on this. However, since the trajectory data provided by the AIS system is usually data obtained from multiple sensors, the data types are complex and diverse, and the data volume is large. At the same time, the trajectory data provided by the AIS system often has missing or incomplete data due to equipment failures, signal interruptions or human operation errors. Existing methods often rely on simple statistical models or primary machine learning algorithms. When processing these trajectory data, it is difficult to effectively integrate and utilize the dynamic change information and deep-level relationships in the complex and incomplete trajectory data, resulting in a low accuracy of ship traffic flow prediction.

[0004] Therefore, the prior art has the technical problem that it is difficult to effectively integrate and utilize the dynamic change information and deep-level relationships in the complex and incomplete trajectory data, resulting in a low accuracy of ship traffic flow prediction, and improvement is needed. Summary of the Invention

[0005] In view of this, it is necessary to provide a method, device, electronic device and storage medium for predicting ship traffic flow to solve the technical problem in the prior art that it is difficult to effectively integrate and utilize the dynamic change information and deep-level relationships in the complex and incomplete trajectory data, resulting in a low accuracy of ship traffic flow prediction.

[0006] To solve the above problems, on the one hand, the present invention provides a method for predicting ship traffic flow, including:

[0007] Obtain the ship trajectory data of the port to be detected, and perform two-way trajectory prediction and repair on the ship trajectory data to obtain repaired trajectory data;

[0008] Perform direction recognition trajectory clustering on the repaired trajectory data to obtain trajectory clustering data, and perform density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data;

[0009] Perform spatio-temporal feature extraction and prediction output on the node clustering data to obtain the ship traffic flow prediction result.

[0010] In a possible implementation, performing two-way trajectory prediction and repair on the ship trajectory data to obtain repaired trajectory data includes:

[0011] Input the ship trajectory data into a preset bidirectional long short-term memory network, perform forward hidden layer sequence analysis on the ship trajectory data to obtain a forward hidden state vector, perform backward hidden layer sequence analysis on the ship trajectory data to obtain a backward hidden state vector, and splice and combine the forward hidden state vector and the backward hidden state vector to obtain a bidirectional hidden state vector;

[0012] Perform attention extraction on the bidirectional hidden state vector to obtain an attention context vector;

[0013] Splice the bidirectional hidden state vector and the attention context vector to obtain an attention enhanced vector;

[0014] Perform output layer prediction on the attention enhanced vector to obtain a trajectory prediction output;

[0015] Fill in the missing values of the ship trajectory data according to the trajectory prediction output to obtain repaired trajectory data.

[0016] In a possible implementation, performing direction recognition trajectory clustering on the repaired trajectory data to obtain trajectory clustering data includes:

[0017] Evaluate the similarity of the repaired trajectory data based on the direction recognition improved Hamming distance to obtain trajectory similarity;

[0018] Cluster the repaired trajectory data according to the trajectory similarity to obtain trajectory clustering data.

[0019] In a possible implementation, performing density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data includes:

[0020] Perform local density evaluation on the trajectory clustering data to obtain the local density of each node in the trajectory clustering data;

[0021] Divide the trajectory clustering data into high-density regions and low-density regions according to the local density and a preset global density threshold;

[0022] Determine the high-density clustering parameters for the high-density regions and the low-density clustering parameters for the low-density regions according to the local density;

[0023] Perform clustering processing on the high-density regions according to the high-density clustering parameters to obtain high-density clustering data, and perform clustering processing on the low-density regions according to the low-density clustering parameters to obtain low-density clustering data;

[0024] Merge the high-density data and the low-density data to obtain node clustering data.

[0025] In a possible implementation, perform local density evaluation on the trajectory clustering data to obtain the local density of each node in the trajectory clustering data, including:

[0026] Perform comprehensive distance evaluation on each node and its corresponding neighboring nodes in the trajectory clustering data based on the improved Hausdorff distance to obtain the comprehensive distance of the neighboring nodes of each node;

[0027] Determine the local density of each node according to the comprehensive distance of the neighboring nodes;

[0028] Among them, the comprehensive distance evaluation includes position distance evaluation, direction difference evaluation, and speed difference evaluation.

[0029] In a possible implementation, perform spatio-temporal feature extraction and prediction output on the node clustering data to obtain the ship traffic flow prediction result, including:

[0030] Perform Chebyshev convolution on the node clustering data to obtain spatial feature data;

[0031] Perform spatio-temporal feature embedding enhancement on the spatial feature data to obtain spatio-temporal embedding features;

[0032] Perform dilated causal convolution and gated temporal convolution on the spatio-temporal embedding features in sequence to obtain traffic flow features;

[0033] Perform prediction output on the traffic flow features to obtain the ship traffic flow prediction result.

[0034] In a possible implementation, perform spatio-temporal feature embedding enhancement on the spatial feature data to obtain spatio-temporal embedding features, including:

[0035] Construct preliminary spatio-temporal sequence data according to the spatial feature data;

[0036] Perform spatial dimension splitting on the preliminary spatio-temporal sequence data to obtain a spatial embedding tensor, and perform temporal dimension splitting on the preliminary spatio-temporal sequence data to obtain a temporal embedding tensor;

[0037] Incorporate the spatial embedding tensor and the temporal embedding tensor into the preliminary spatio-temporal sequence data to obtain spatio-temporal embedding features.

[0038] On the other hand, the present invention also provides a ship traffic flow prediction device, including:

[0039] A trajectory repair unit, configured to obtain ship trajectory data of a port to be detected, and perform trajectory repair on the ship trajectory data to obtain repaired trajectory data;

[0040] A data clustering unit, configured to perform direction recognition trajectory clustering on the repaired trajectory data to obtain trajectory clustering data, and perform density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data;

[0041] A prediction output unit, configured to perform spatio-temporal feature extraction and prediction output on the node clustering data to obtain a ship traffic flow prediction result.

[0042] On the other hand, the present invention also provides an electronic device, including a processor, a memory, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the above-mentioned ship traffic flow prediction method is implemented.

[0043] On the other hand, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned ship traffic flow prediction method is implemented.

[0044] The beneficial effects of the present invention are as follows: In the ship traffic flow prediction method provided by the present invention, first, ship trajectory data of a port to be detected is obtained, and two-way trajectory prediction repair is performed on the ship trajectory data to obtain repaired trajectory data; then, direction recognition trajectory clustering is performed on the repaired trajectory data to obtain trajectory clustering data, and density adaptive parameter node clustering is performed on the trajectory clustering data to obtain node clustering data; finally, spatio-temporal feature extraction and prediction output are performed on the node clustering data to obtain a ship traffic flow prediction result. The present invention ensures the integrity of ship trajectory data through two-way trajectory prediction repair, mines the trajectory direction information therein while clustering trajectories through direction recognition trajectory clustering, and mines the node comprehensive information therein while clustering nodes through density adaptive parameter node clustering. It can effectively integrate data while retaining dynamic transformation information and deep relationships, and improve the accuracy of ship traffic flow prediction. Description of the Drawings

[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained without creative efforts based on these drawings.

[0046] Figure 1Schematic flowchart of an embodiment of the ship traffic flow prediction method provided by the present invention;

[0047] Figure 2 Schematic flowchart of the two-way trajectory prediction repair in the embodiment of the present invention;

[0048] Figure 3 Schematic flowchart of the direction recognition trajectory clustering in the embodiment of the present invention;

[0049] Figure 4 Schematic flowchart of the density adaptive parameter node clustering in the embodiment of the present invention;

[0050] Figure 5 Schematic flowchart of the local density evaluation in the embodiment of the present invention;

[0051] Figure 6 Schematic flowchart of the spatio-temporal feature extraction and prediction output in the embodiment of the present invention;

[0052] Figure 7 Schematic flowchart of the spatio-temporal feature embedding enhancement in the embodiment of the present invention;

[0053] Figure 8 Schematic structural diagram of an embodiment of the ship traffic flow prediction device provided by the present invention;

[0054] Figure 9 Schematic structural diagram of an embodiment of the electronic device provided by the present invention. Detailed implementation manners

[0055] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present invention.

[0056] In the description of the embodiments of the present invention, unless otherwise specified, "a plurality of" means two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships, for example: A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. These three situations.

[0057] The descriptions such as "first" and "second" involved in the embodiments of the present invention are only for descriptive purposes, and cannot be understood as indicating or implying their relative importance or implicitly indicating the quantity of the indicated technical features. Therefore, the technical features defined with "first" and "second" may explicitly or implicitly include at least one such feature.

[0058] References to "embodiments" in this specification mean that the particular features, structures, or characteristics described in connection with the embodiments can be included in at least one embodiment of the invention. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.

[0059] The present invention provides a method, apparatus, electronic device, and storage medium for predicting ship traffic flow, which will be described separately below.

[0060] Figure 1 It is a schematic flowchart of an embodiment of the ship traffic flow prediction method provided by the present invention, as Figure 1 shown. The ship traffic flow prediction method includes:

[0061] S101. Obtain the ship trajectory data of the port to be detected, and perform two-way trajectory prediction repair on the ship trajectory data to obtain repaired trajectory data;

[0062] S102. Perform direction recognition trajectory clustering on the repaired trajectory data to obtain trajectory clustering data, and perform density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data;

[0063] S103. Perform spatio-temporal feature extraction and prediction output on the node clustering data to obtain the ship traffic flow prediction result.

[0064] Compared with the prior art, the ship traffic flow prediction method provided by the embodiments of the present invention first obtains the ship trajectory data of the port to be detected, and performs two-way trajectory prediction repair on the ship trajectory data to obtain repaired trajectory data; then performs direction recognition trajectory clustering on the repaired trajectory data to obtain trajectory clustering data, and performs density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data; finally, performs spatio-temporal feature extraction and prediction output on the node clustering data to obtain the ship traffic flow prediction result. The present invention ensures the integrity of the ship trajectory data through two-way trajectory prediction repair, mines the trajectory direction information during trajectory clustering through direction recognition trajectory clustering, and mines the node comprehensive information during node clustering through density adaptive parameter node clustering. It can effectively integrate the data while retaining the dynamic transformation information and deep relationships, and improve the accuracy of ship traffic flow prediction.

[0065] In some embodiments of the present invention, Figure 2 It is a schematic flowchart of the two-way trajectory prediction repair of the embodiment of the present invention, as Figure 2 shown. Performing two-way trajectory prediction repair on the ship trajectory data to obtain repaired trajectory data includes:

[0066] S201. Input the ship trajectory data into a preset bidirectional long short-term memory network, perform forward hidden layer sequence analysis on the ship trajectory data to obtain a forward hidden state vector, perform backward hidden layer sequence analysis on the ship trajectory data to obtain a backward hidden state vector, and splice and combine the forward hidden state vector and the backward hidden state vector to obtain a bidirectional hidden state vector;

[0067] S202. Extract attention from the bidirectional hidden state vector to obtain an attention context vector;

[0068] S203. Splice the bidirectional hidden state vector and the attention context vector to obtain an attention enhanced vector;

[0069] S204. Perform output layer prediction on the attention enhanced vector to obtain a trajectory prediction output;

[0070] S205. Fill in the missing values of the ship trajectory data according to the trajectory prediction output to obtain repaired trajectory data.

[0071] Specifically, to ensure the integrity of the ship trajectory data, the embodiment repairs the ship trajectory data through a bidirectional LSTM (Long Short Term Memory) with an attention mechanism.

[0072] Among them, LSTM solves the problems of gradient disappearance and gradient explosion in conventional RNNs through memory units and gating mechanisms: input gate, forget gate, and output gate, enabling the network to capture and utilize long-term dependencies, thereby effectively processing time series data.

[0073] In LSTM, the memory unit enables the LSTM network to transmit information across time steps in a time series, solving the problem of gradient disappearance. The forget gate determines which information should be deleted from the memory unit. The input gate is responsible for controlling the addition of new information, including data input and update. It supplements information after being screened by the forget gate and determines the new output through the combination of Sigmoid and Tanh functions.

[0074] The calculation formula for the forget gate is as follows:

[0075]

[0076] The forget gate calculates based on the input and the hidden state transmitted from the previous layer, where and are weight information. The calculation result ranges from 0 to 1. 0 means that no information at the moment is retained, and 1 means all information is retained.

[0077] The calculation formula for the input gate is expressed as:

[0078]

[0079]

[0080] Cell information at the previous moment and candidate cell information at past moments are updated through the following formula to obtain the cell information at the current moment and input into the hidden layer at the next moment:

[0081]

[0082] The output gate determines which information to output at the current time step and is mainly responsible for determining the value entering the next hidden state.

[0083] After the cell state is updated, the final output is calculated through the following formula :

[0084]

[0085]

[0086] The bidirectional long short-term memory network BiLSTM is an extension of LSTM. It combines forward and backward information to process sequences, enhances the ability to capture sequence context through forward and backward processing, and improves the understanding and prediction performance of the model.

[0087] BiLSTM analyzes the forward and backward sequences through two independent hidden layers, and the finally output predicted value is jointly determined by the forward and backward hidden layers.

[0088] Among them, the output of the forward hidden layer is:

[0089]

[0090] The output of the backward hidden layer is:

[0091]

[0092] Among them, in the formula of the forward hidden layer is the output weight of the forward propagation unit hidden layer, is the weight from the previous moment state quantity to the current moment state quantity in forward propagation, is the output value of the previous moment hidden layer state in forward propagation, is the bias term in forward propagation, and the parameters corresponding to the formula of the backward hidden layer are the parameters in backward propagation.

[0093] The attention mechanism is a technique in machine learning used to quantify the importance of information and is widely applied in fields such as natural language processing, image recognition, and speech recognition. It determines the relative importance of information items through three components: the query matrix (Query), the key (Key), and the value (Value).

[0094] The attention mechanism quantifies the importance of information through the key (K), weight value (V), data source (S), query (Q), and attention value (A). Each data source element is a key-value pair , where is the key is the weight related to the similarity with the query Q. By weighting and summing, the result A is obtained. The attention mechanism is essentially the sum of weighted data source elements and can be expressed by the formula:

[0095]

[0096] where is the length of the input data. The calculation of the attention value can be divided into three stages:

[0097] In the first stage, the correlation between the Query and different Keys is calculated, that is, the weight coefficients of different Value values are calculated, which can be expressed by the formula:

[0098]

[0099]

[0100]

[0101] Among the three similarity calculation methods, the first calculates the similarity between Q and K using the dot product, the second uses Cosine similarity, and the normalized score from -1 to 1 is obtained by dividing the dot product by the product of the norms. The third uses a neural network to automatically learn the feature weights to generate the similarity score.

[0102] In the second stage, the output of the previous stage is normalized to map the value range between 0 and 1:

[0103]

[0104] In this way, the original relevance can be converted into normalized attention weights, which can be used to calculate the weighted average or weighted sum to obtain the weighted representation of different elements in the input sequence.

[0105] In the third stage, the Value is weighted and summed according to the weight coefficients to obtain the final attention value, which is expressed by the formula:

[0106]

[0107] In the process of predicting missing values in ship trajectory data, by combining the above methods, when combining the attention mechanism and the bidirectional long short-term memory network, the role of the attention mechanism is to assign a weight to the features of each input time step, so as to guide the network to focus on the most important part of the sequence data for the current task.

[0108] Among them, the embodiment first generates a hidden state vector through the bidirectional long short-term memory network. The BiLSTM network generates a forward hidden state vector through its two hidden layers in the forward and backward directions respectively and a backward hidden state vector . The final state vector is the concatenation or weighted sum of the two:

[0109]

[0110] In the attention calculation, after obtaining the set of hidden state vectors of the BiLSTM output sequence , the attention mechanism assigns a weight to the hidden state vector of each time step through the calculation of query, key, and value. The specific steps are as follows:

[0111] First, use the target task context to generate a query vector , then the set of hidden state vectors is used as the key and value, and the query calculation and the similarity of each key are calculated, and the softmax function is used to normalize the similarity to a weight :

[0112]

[0113] Then, according to the normalized weight , the values of each hidden state vector are weighted and summed to obtain the attention context vector :

[0114]

[0115] The context vector represents the most important information in the input sequence for the current task.

[0116] Then, the attention context vector is combined with the global hidden state after the concatenation of the BILSTM hidden state to form an attention-enhanced vector , and is used in the prediction task to obtain the trajectory prediction output.

[0117] Finally, based on the obtained trajectory prediction output, the initial ship trajectory data is filled with missing values to obtain the repaired trajectory data.

[0118] In some embodiments of the present invention, Figure 3 is a schematic flow chart of the direction recognition trajectory clustering of the embodiments of the present invention. As Figure 3 shown, the repaired trajectory data is subjected to direction recognition trajectory clustering to obtain trajectory clustering data, including:

[0119] S301. Evaluate the similarity of the repaired trajectory data based on the direction recognition improved Hamming distance to obtain the trajectory similarity;

[0120] S302. Cluster the repaired trajectory data according to the trajectory similarity to obtain the trajectory clustering data.

[0121] Specifically, considering that the trajectory data provided by the AIS system is usually data obtained from multiple sensors, the data types are complex and diverse and the data volume is large, clustering is required to reduce the data processing volume. At the same time, in order to ensure that the dynamic change information and deep-level relationships in the trajectory data can be retained and mined during this process, and to improve the accuracy of subsequent traffic flow prediction, the embodiments adopt direction recognition trajectory clustering and density adaptive parameter node clustering to perform clustering operations on the trajectory and nodes in sequence.

[0122] During the trajectory clustering process, traditional trajectory clustering methods include Euclidean distance, DTW (Dynamic Time Warping), Fréchet distance, Hamming distance, etc., each having its applicable scenarios. The embodiments of the present invention consider the characteristics of the trajectory data and adopt an improved Hamming distance algorithm for trajectory clustering.

[0123] The traditional Hamming distance evaluates the similarity by calculating the maximum and minimum distances, can capture shape differences, but is affected by outliers and cannot distinguish directions, affecting the clustering effect. Its formula is:

[0124]

[0125] Where and represent two trajectories respectively, represents the Euclidean distance.

[0126] The traditional Hamming distance mainly considers the maximum distance between points and ignores the overall shape and directionality of the trajectory. To overcome this limitation, the method proposed in the embodiments not only calculates the shortest distance from the points on the trajectory to the line segment, but also introduces direction sensitivity, making the metric more in line with the actual application requirements of the trajectory data.

[0127] Combined with the trajectory segment distance calculation and direction recognition mechanism, the improved Hamming distance formula for direction recognition in the embodiment is as follows:

[0128]

[0129] Wherein, is an adjustment function based on the direction cosine value, defined as:

[0130]

[0131] Wherein, here is usually greater than 1, used to increase the distance between trajectories with opposite directions and reduce their similarity scores. This method quantifies the spatial and direction attributes of trajectories, providing a more refined and adaptable similarity measurement method for trajectory clustering.

[0132] In some embodiments of the present invention, Figure 4 is a schematic flow diagram of density adaptive parameter node clustering in the embodiment of the present invention. As shown in Figure 4 shown, performing density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data, including:

[0133] S401. Perform local density evaluation on the trajectory clustering data to obtain the local density of each node in the trajectory clustering data;

[0134] S402. Divide the trajectory clustering data into high-density regions and low-density regions according to the local density and a preset global density threshold;

[0135] S403. Determine the high-density clustering parameters of the high-density region and the low-density clustering parameters of the low-density region according to the local density;

[0136] S404. Perform clustering processing on the high-density region according to the high-density clustering parameters to obtain high-density clustering data, and perform clustering processing on the low-density region according to the low-density clustering parameters to obtain low-density clustering data;

[0137] S405. Combine the high-density data and the low-density data to obtain the node clustering data.

[0138] In some embodiments of the present invention, Figure 5 is a schematic flow diagram of local density evaluation in the embodiment of the present invention. As shown in Figure 5 shown, performing local density evaluation on the trajectory clustering data to obtain the local density of each node in the trajectory clustering data, including:

[0139] S501. Perform comprehensive distance evaluation on each node and its corresponding neighboring nodes in the trajectory clustering data based on the improved Hausdorff distance to obtain the comprehensive distance of neighboring nodes of each node;

[0140] S502. Determine the local density of each node according to the comprehensive distance of adjacent nodes;

[0141] Among them, the comprehensive distance evaluation includes position distance evaluation, direction difference evaluation and speed difference evaluation.

[0142] Specifically, in the process of node clustering, the traditional point clustering method is DBSCAN (Density-Based Spatial Clustering of Applications with Noise), which can perform clustering processing based on density points. However, considering the characteristics of the node distribution in trajectory data, for example, in the area near the port, the route nodes are more densely distributed, and in the area far from the port, the route nodes are more sparsely distributed. The existing DBSCAN has limitations in dealing with multi-density route nodes. Therefore, the embodiment provides a method for density adaptive parameter node clustering, which dynamically adjusts the clustering parameters to adapt to the data density change, and uses local density measurement to optimize the parameter selection, overcoming the limitations of the traditional DBSCAN with fixed global parameters and improving the flexibility.

[0143] First of all, the embodiment needs to first determine the process of the local density of each part of the nodes. Considering that the nodes in the trajectory data are not just simple position points, but also include information such as speed and heading. In this regard, the embodiment evaluates the local density of nodes by improving the Hausdorff distance, comprehensively considering position, heading and speed, effectively adapting to complex density distributions, and is particularly suitable for the clustering analysis of dynamic ship trajectory data.

[0144] For each point in the dataset , first determine its nearest neighbor nodes, and calculate the distance from point to these neighboring nodes, including the evaluation of position distance, direction difference and speed difference. The distance formula is as follows:

[0145]

[0146] Among them, and represent the coordinates of point , represents the heading of point , represents the speed of point , and the weights and control the contribution ratio of heading and speed differences to the total distance.

[0147] Then the embodiment uses these distances to calculate the local density of point , the density is estimated by summing the distances to the nearest neighbors and taking the reciprocal:

[0148]

[0149] The examples reflect the density around a point through this formula. A higher density value indicates more or closer neighbors. In this way, we can provide a quantitative density assessment for each point in the dataset, which is the basis for subsequent parameter adjustment and clustering decision-making.

[0150] Based on the local density of each point, density adaptive parameter node clustering can dynamically adjust the clustering parameters. This adjustment is to enable the algorithm to adapt to the density inhomogeneity within the dataset and improve the accuracy and flexibility of clustering.

[0151] According to the evaluation of the local density, the examples set a global density threshold to distinguish high-density and low-density regions. For points located in high-density regions (i.e., ), the examples reduce the neighborhood radius and increase the minimum number of neighbors to prevent over-clustering and ensure that only truly dense regions form clusters:

[0152]

[0153]

[0154] Conversely, for points located in low-density regions (i.e., ρ(p) ≤ θ), we increase the neighborhood radius and reduce the minimum number of neighbors to facilitate connecting sparsely distributed points:

[0155]

[0156]

[0157] Density adaptive parameter node clustering adapts to different density regions by dynamically adjusting parameters, maintaining the clustering quality, effectively identifying and separating clusters, which is the key advantage in dealing with complex datasets. The examples divide the trajectory clustering data into high-density and low-density regions and then use different adaptive clustering parameters for clustering respectively, and merge the results after clustering to obtain the node clustering data.

[0158] In some embodiments of the present invention, Figure 6 is a schematic flow diagram of the spatio-temporal feature extraction and prediction output of the embodiments of the present invention, as shown in Figure 6As shown in the figure, spatio-temporal feature extraction and prediction output are performed on the node clustering data to obtain the ship traffic flow prediction result, including:

[0159] S601. Perform Chebyshev convolution on the node clustering data to obtain spatial feature data;

[0160] S602. Perform spatio-temporal feature embedding enhancement on the spatial feature data to obtain spatio-temporal embedding features;

[0161] S603. Perform dilated causal convolution and gated temporal convolution on the spatio-temporal embedding features in sequence to obtain traffic flow features;

[0162] S604. Perform prediction output on the traffic flow features to obtain the ship traffic flow prediction result.

[0163] Specifically, the graph neural network model used for ship traffic flow prediction in the embodiment mainly includes three parts, namely, a spatial graph convolutional network for extracting spatial feature data of ship traffic flow, a spatio-temporal embedding module for feature enhancement, and a gated temporal convolutional network for extracting temporal features. These are combined into multiple spatio-temporal graph convolutional modules and through residual connections, effectively fuse the temporal and spatial features of ship traffic flow, and perform prediction output on the obtained traffic flow features to obtain an accurate ship traffic flow prediction result.

[0164] In the prediction of route network traffic flow, the route network data comes from sensors at different locations, and the traffic volumes of these sensors affect each other, which is suitable to be represented by a graph structure. The graph is defined as , where is the node set, is the edge set.

[0165] In existing research, the spatial distance values between traffic network nodes are usually used to construct its topological structure. The construction method of its adjacency matrix is that if the distance between node and node is greater than the threshold and , then the corresponding element in the adjacency matrix is set to 1, which can be expressed by the formula:

[0166]

[0167] The method of constructing the adjacency matrix based on distance values is simple, intuitive, and easy to operate, but there are also some problems. There will also be correlations between nodes with a relatively large distance, that is, the magnitude of the distance value between two nodes does not necessarily reflect their adjacency relationship.

[0168] In this regard, GCN can better process data with non-Euclidean structures such as traffic network topologies. By using graph convolutional networks, the topological relationships between nodes and their surrounding nodes can be accurately extracted, thus more effectively capturing the spatial features of traffic data. In a graph convolutional network, the topological structure can be represented by the Laplacian matrix, and its standard form is defined as:

[0169]

[0170] where is the identity matrix with diagonal elements of 1, is the adjacency matrix of the graph, is the diagonal matrix composed of the degrees of nodes, can be decomposed into:

[0171]

[0172] is the matrix composed of the eigenvectors, is its eigenvalue diagonal matrix. The graph convolution calculation formula can be expressed as:

[0173]

[0174] where represents the convolution of two signals, and represent the and graph Fourier transforms, represents the Hadamard product. According to the commutative law of multiplication, let , and the formula can be further obtained:

[0175]

[0176] However, although the frequency-domain method of graph convolution can achieve graph signal convolution, it has a high computational complexity and mainly captures first-order proximity relationships, without fully utilizing the local properties of the graph. To solve these problems, the embodiment introduces a Chebyshev convolutional network, and approximates the convolution kernel through the -order Chebyshev polynomial:

[0177]

[0178] where , represents the largest eigenvalue of the Laplacian matrix, the Chebyshev polynomial is defined as , is the polynomial coefficient, , , through the -th iteration of the polynomial, the computational complexity can be effectively reduced.

[0179] Then, the embodiment adopts gated temporal convolution and dilated causal convolution techniques to extract the temporal features of traffic flow, expands the receptive field by increasing the number of layers, effectively captures temporal dependencies. Compared with RNN, TCN avoids the cyclic structure, is more efficient and reduces the risk of gradient explosion. In the process of dilated causal convolution, given the input sequence , the dilated convolution operation can be defined as:

[0180]

[0181] where, represents the dilated convolution operator, is the sequence length, is the dilation parameter, is the convolution kernel size.

[0182] The temporal convolution TCN maintains the optimal state of the network by setting residual units and using the concatenation of identity mapping and residual mapping, avoiding gradient vanishing and explosion.

[0183] To solve the problem that TCN cannot effectively capture the long-term dependencies of temporal features, it is considered to add a gating mechanism to TCN, combine the temporal convolution operation and the gating unit to obtain gated TCN, so as to better capture the long-term dependencies in time series data. By controlling the flow of information through the gating unit, the modeling ability of the network for time series data can be improved, especially suitable for processing long sequence data.

[0184] In the gated TCN layer, for the given input data , the output , where and are two different convolution operations, and the two activation functions respectively control the retention and forgetting of information.

[0185] In some embodiments of the present invention, Figure 7 is a schematic flow diagram of enhancing spatio-temporal feature embedding in the embodiments of the present invention. As Figure 7 shown, enhancing the spatio-temporal feature embedding of spatial feature data to obtain spatio-temporal embedding features includes:

[0186] S701. Construct preliminary spatio-temporal sequence data according to the spatial feature data;

[0187] S702. Split the preliminary spatio-temporal sequence data in the spatial dimension to obtain a spatial embedding tensor, and split the preliminary spatio-temporal sequence data in the temporal dimension to obtain a temporal embedding tensor;

[0188] S703. Incorporate the spatial embedding tensor and the temporal embedding tensor into the preliminary spatio-temporal sequence data to obtain spatio-temporal embedding features.

[0189] Specifically, the embodiment takes into account that although the GCN effectively extracts the spatial features of traffic flow, it does not fully consider the information in the time dimension. To further enhance the network's feature recognition ability, the embodiment adds a spatio-temporal embedding module between the spatial graph convolutional network and the gated temporal convolutional network to enhance the feature embedding.

[0190] The embodiment first constructs a spatio-temporal sequence based on the graph structure data output by the graph convolutional layer. Among them, the vertical dimension of the sequence represents the embedding of spatial features, and the horizontal dimension represents the embedding of temporal features. In this way, the capture of the dependence relationship of traffic flow in time and space is realized.

[0191] For the input spatio-temporal sequence , where is the number of nodes, is the feature dimension, is the number of time steps. The embodiment first splits into an embedding tensor in the spatial dimension, and then splits it into an embedding tensor along the time dimension. Subsequently, a 1×1 convolution operation is used to process these two embedding tensors to ensure that they contain the necessary spatio-temporal information. Finally, through the broadcast mechanism, these embedding tensors are added to the spatio-temporal sequence to obtain a new spatio-temporal sequence as the input of the next layer of gated temporal convolutional network.

[0192] In summary, the ship traffic flow prediction method provided by the present invention first obtains the ship trajectory data of the port to be detected, and performs bidirectional trajectory prediction repair on the ship trajectory data to obtain repaired trajectory data; then performs direction recognition trajectory clustering on the repaired trajectory data to obtain trajectory clustering data, and performs density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data; finally, performs spatio-temporal feature extraction and prediction output on the node clustering data to obtain the ship traffic flow prediction result. The present invention ensures the integrity of ship trajectory data through bidirectional trajectory prediction repair, mines the trajectory direction information during trajectory clustering through direction recognition trajectory clustering, and mines the node comprehensive information during node clustering through density adaptive parameter node clustering. It can effectively integrate the data while retaining the dynamic transformation information and deep relationships, and improve the accuracy of ship traffic flow prediction.

[0193] To better implement the ship traffic flow prediction method in the embodiments of the present invention, correspondingly, on the basis of the ship traffic flow prediction method, as Figure 8As shown in the figure, the present invention also provides a ship traffic flow prediction device. The ship traffic flow prediction device 800 includes:

[0194] A trajectory repair unit 801, configured to obtain ship trajectory data of a port to be detected, and perform trajectory repair on the ship trajectory data to obtain repaired trajectory data;

[0195] A data clustering unit 802, configured to perform direction recognition trajectory clustering on the repaired trajectory data to obtain trajectory clustering data, and perform density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data;

[0196] A prediction output unit 803, configured to perform spatio-temporal feature extraction and prediction output on the node clustering data to obtain a ship traffic flow prediction result.

[0197] The ship traffic flow prediction device 800 provided in the above embodiment can implement the technical solutions described in the above ship traffic flow prediction method embodiment. The specific implementation principles of the above modules or units can be referred to the corresponding content in the above ship traffic flow prediction method embodiment, which will not be elaborated here.

[0198] As Figure 9 shown in the figure, the present invention also correspondingly provides an electronic device 900. The electronic device 900 includes a processor 901, a memory 902, and a display 903. Figure 9 Only some components of the electronic device 900 are shown, but it should be understood that it is not required to implement all the shown components, and more or fewer components can be alternatively implemented.

[0199] The processor 901 may be a central processing unit (CPU), a microprocessor, or other data processing chips in some embodiments, and is configured to run program codes stored in the memory 902 or process data, such as the ship traffic flow prediction method in the present invention.

[0200] In some embodiments, the processor 901 may be a single server or a server group. The server group may be centralized or distributed. In some embodiments, the processor 901 may be local or remote. In some embodiments, the processor 901 may be implemented on a cloud platform. In one embodiment, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an internal cloud, a multi-cloud, etc., or any combination of the above.

[0201] The memory 902 can be an internal storage unit of the electronic device 900 in some embodiments, such as the hard disk or memory of the electronic device 900. The memory 902 can also be an external storage device of the electronic device 900 in other embodiments, such as a plug-in hard disk equipped on the electronic device 900, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc.

[0202] Furthermore, the memory 902 can include both the internal storage unit of the electronic device 900 and the external storage device. The memory 902 is used to store the application software installed on the electronic device 900 and various types of data.

[0203] The display 903 can be an LED display, a liquid crystal display, a touch liquid crystal display, and an OLED (Organic Light-Emitting Diode) toucher, etc. in some embodiments. The display 903 is used to display the information of the electronic device 900 and to display a visual user interface. The components 901 - 903 of the electronic device 900 communicate with each other through the system bus.

[0204] In one embodiment, when the processor 901 executes the ship traffic flow prediction program in the memory 902, the following steps can be implemented:

[0205] Obtain the ship trajectory data of the port to be detected, and perform two-way trajectory prediction repair on the ship trajectory data to obtain repaired trajectory data;

[0206] Perform direction recognition trajectory clustering on the repaired trajectory data to obtain trajectory clustering data, and perform density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data;

[0207] Perform spatio-temporal feature extraction and prediction output on the node clustering data to obtain the ship traffic flow prediction result.

[0208] It should be understood that when the processor 901 executes the ship traffic flow prediction program in the memory 902, in addition to the above functions, other functions can also be implemented. For specific details, please refer to the description of the corresponding method embodiments above.

[0209] Correspondingly, the embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium is used to store computer-readable programs or instructions. When the programs or instructions are executed by the processor, the steps or functions in the ship traffic flow prediction method provided by the above method embodiments can be implemented.

[0210] Those skilled in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a computer-readable storage medium. Among them, the computer-readable storage medium is a disk, an optical disc, a read-only memory, or a random access memory, etc.

[0211] The above has introduced in detail the ship traffic flow prediction method, device, electronic device and storage medium provided by the present invention. Specific examples are used in this article to elaborate on the principle and implementation manner of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present invention.

Claims

1. A method for predicting ship traffic flow, characterized in that, Including: Obtain the ship trajectory data of the port to be detected, and perform two-way trajectory prediction repair on the ship trajectory data to obtain repaired trajectory data; Perform direction recognition trajectory clustering on the repaired trajectory data to obtain trajectory clustering data, perform local density evaluation on the trajectory clustering data to obtain the local density of each node in the trajectory clustering data; divide the trajectory clustering data into a high-density area and a low-density area according to the local density and a preset global density threshold; determine the high-density clustering parameters of the high-density area and the low-density clustering parameters of the low-density area according to the local density; perform clustering processing on the high-density area according to the high-density clustering parameters to obtain high-density clustering data, perform clustering processing on the low-density area according to the low-density clustering parameters to obtain low-density clustering data; merge the high-density clustering data and the low-density clustering data to obtain node clustering data; Perform Chebyshev convolution on the node clustering data to obtain spatial feature data; construct preliminary spatio-temporal sequence data according to the spatial feature data; Perform spatial dimension splitting on the preliminary spatio-temporal sequence data to obtain a spatial embedding tensor, and perform temporal dimension splitting on the preliminary spatio-temporal sequence data to obtain a temporal embedding tensor; incorporate the spatial embedding tensor and the temporal embedding tensor into the preliminary spatio-temporal sequence data to obtain spatio-temporal embedding features; Perform dilated causal convolution and gated temporal convolution on the spatio-temporal embedding features in sequence to obtain traffic flow features; Perform prediction output on the traffic flow features to obtain a ship traffic flow prediction result.

2. The ship traffic flow prediction method according to claim 1, wherein The performing two-way trajectory prediction repair on the ship trajectory data to obtain repaired trajectory data includes: Input the ship trajectory data into a preset bidirectional long short-term memory network, perform forward hidden layer sequence analysis on the ship trajectory data to obtain a forward hidden state vector, perform backward hidden layer sequence analysis on the ship trajectory data to obtain a backward hidden state vector, and splice and merge the forward hidden state vector and the backward hidden state vector to obtain a bidirectional hidden state vector; Perform attention extraction on the bidirectional hidden state vector to obtain an attention context vector; Splice the bidirectional hidden state vector and the attention context vector to obtain an attention enhanced vector; Perform output layer prediction on the attention enhanced vector to obtain a trajectory prediction output; Fill in the missing values of the ship trajectory data according to the trajectory prediction output to obtain repaired trajectory data.

3. The ship traffic flow prediction method according to claim 1, characterized in that The performing direction recognition trajectory clustering on the repaired trajectory data to obtain trajectory clustering data includes: Perform similarity evaluation on the repaired trajectory data based on a direction recognition improved Hamming distance to obtain trajectory similarity; Perform clustering on the repaired trajectory data according to the trajectory similarity to obtain trajectory clustering data.

4. A device for predicting ship traffic flow, characterized in that Including: A trajectory repair unit, configured to obtain the ship trajectory data of the port to be detected, and perform trajectory repair on the ship trajectory data to obtain repaired trajectory data; A data clustering unit, which is used to perform direction recognition trajectory clustering on the repaired trajectory data to obtain trajectory clustering data, and perform local density evaluation on the trajectory clustering data to obtain the local density of each node in the trajectory clustering data; divide the trajectory clustering data into a high-density area and a low-density area according to the local density and a preset global density threshold; determine a high-density clustering parameter of the high-density area and a low-density clustering parameter of the low-density area according to the local density; perform clustering processing on the high-density area according to the high-density clustering parameter to obtain high-density clustering data, and perform clustering processing on the low-density area according to the low-density clustering parameter to obtain low-density clustering data; merge the high-density clustering data and the low-density clustering data to obtain node clustering data; A prediction output unit, which is used to perform Chebyshev convolution on the node clustering data to obtain spatial feature data; construct preliminary spatio-temporal sequence data according to the spatial feature data; perform spatial dimension splitting on the preliminary spatio-temporal sequence data to obtain a spatial embedding tensor, and perform time dimension splitting on the preliminary spatio-temporal sequence data to obtain a time embedding tensor; incorporate the spatial embedding tensor and the time embedding tensor into the preliminary spatio-temporal sequence data to obtain spatio-temporal embedding features; perform dilated causal convolution and gated temporal convolution on the spatio-temporal embedding features in sequence to obtain traffic flow features; perform prediction output on the traffic flow features to obtain a ship traffic flow prediction result.

5. An electronic device, comprising a processor, a memory, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the ship traffic flow prediction method according to any one of claims 1 to 3.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the ship traffic flow prediction method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Ship traffic flow prediction method based on improved graph convolutional neural network

    CN114565124A