Ship traffic flow prediction method and device, electronic equipment and storage medium
By performing bidirectional trajectory prediction and repair of ship trajectory data, direction identification trajectory clustering and density adaptive parameter node clustering, the problem of difficulty in integrating complex and incomplete trajectory data in the existing technology is solved, and the accuracy of ship traffic flow prediction is significantly improved.
Patent Information
- Application Number
- CN202510459025.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-14
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-04-14
AI Technical Summary
The prior art is difficult to effectively integrate and utilize dynamic change information and deep relationships in complex and incomplete trajectory data, resulting in low accuracy in ship traffic flow prediction.
By obtaining the ship trajectory data of the port to be detected, bidirectional trajectory prediction and repair are carried out to ensure data integrity, then the direction identification trajectory clustering and density adaptive parameter node clustering are performed, and finally the node clustering data is extracted and predicted to improve prediction accuracy.
While retaining dynamic transformed information and deep-seated relationships, the data is effectively integrated to improve the accuracy of ship traffic flow prediction.
Smart Images

Figure CN119989016A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of maritime traffic management, and in particular to a method, device, electronic equipment and storage medium for predicting ship traffic flow. Background Art
[0002] The shipping industry plays a vital role in global trade, with more than 80% of international trade being conducted by sea. With the continuous growth of global port throughput, the increase in ship traffic has posed a severe challenge to water traffic management, especially in narrow waterways, busy anchorages, and dock areas with frequent operations. The frequency of ships entering and exiting is increasing, and there are traffic congestion 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. Through in-depth analysis of the trajectory data provided by the AIS system, the laws of ship traffic activities can be discovered, providing an important reference for water traffic management.
[0003] The existing ship traffic flow prediction is to extract the spatiotemporal features in AIS data through graph neural networks, and use this to predict traffic flow. However, since the trajectory data provided by the AIS system is usually obtained from a variety of 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 is often missing or incomplete due to equipment failure, signal interruption or human operation error. 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 low accuracy in ship traffic flow prediction.
[0004] Therefore, the existing technology has the technical problem of difficulty in effectively integrating and utilizing the dynamic change information and deep-level relationships in complex and incomplete trajectory data, resulting in low accuracy in ship traffic flow prediction, which needs to be improved. Summary of the invention
[0005] In view of this, it is necessary to provide a ship traffic flow prediction method, device, electronic device and storage medium 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 complex and incomplete trajectory data, resulting in low accuracy of ship traffic flow prediction.
[0006] In order to solve the above problems, on the one hand, the present invention provides a method for predicting ship traffic flow, comprising: 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; Direction recognition trajectory clustering is performed on the repair 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; The spatiotemporal features of node clustering data are extracted and predicted to obtain the ship traffic flow prediction results.
[0007] In a possible implementation, performing bidirectional trajectory prediction and repair on the ship trajectory data to obtain repaired trajectory data includes: The ship trajectory data is input into a preset bidirectional long short-term memory network, a forward hidden layer sequence analysis is performed on the ship trajectory data to obtain a forward hidden state vector, a reverse hidden layer sequence analysis is performed on the ship trajectory data to obtain a reverse hidden state vector, and the forward hidden state vector and the reverse hidden state vector are spliced and merged to obtain a bidirectional hidden state vector; Perform attention extraction on the bidirectional hidden state vector to obtain the attention context vector; Concatenate the bidirectional hidden state vector and the attention context vector to obtain the attention enhancement vector; Perform output layer prediction on the attention enhancement vector to obtain trajectory prediction output; According to the trajectory prediction output, the missing values of the ship trajectory data are filled to obtain the repaired trajectory data.
[0008] In a possible implementation, performing direction recognition trajectory clustering on the repair trajectory data to obtain trajectory clustering data includes: The trajectory similarity is obtained by evaluating the similarity of the repaired trajectory data based on the improved Hamming distance based on direction recognition; The repair trajectory data is clustered according to trajectory similarity to obtain trajectory clustering data.
[0009] In a possible implementation, performing density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data includes: Perform local density evaluation on trajectory clustering data to obtain the local density of each node in the trajectory clustering data; The trajectory clustering data is divided into high-density areas and low-density areas according to the local density and the preset global density threshold; Determine high-density clustering parameters for high-density areas and low-density clustering parameters for low-density areas according to local density; The high-density area is clustered according to the high-density clustering parameters to obtain high-density clustering data, and the low-density area is clustered according to the low-density clustering parameters to obtain low-density clustering data; Merge high-density data and low-density data to obtain node clustering data.
[0010] In a possible implementation, local density evaluation is performed on the trajectory clustering data to obtain the local density of each node in the trajectory clustering data, including: Based on the improved Hausdorff distance, the comprehensive distance between each node and the corresponding adjacent nodes in the trajectory clustering data is evaluated to obtain the comprehensive distance of the adjacent nodes of each node; Determine the local density of each node based on the comprehensive distance of neighboring nodes; Among them, the comprehensive distance assessment includes position distance assessment, direction difference assessment and speed difference assessment.
[0011] In a possible implementation, spatiotemporal feature extraction and prediction output are performed on node clustering data to obtain a ship traffic flow prediction result, including: Perform Chebyshev convolution on the node clustering data to obtain spatial feature data; Perform spatiotemporal feature embedding enhancement on spatial feature data to obtain spatiotemporal embedding features; The spatiotemporal embedding features are sequentially subjected to dilated causal convolution and gated temporal convolution to obtain traffic flow features; The traffic flow characteristics are predicted and output to obtain the ship traffic flow prediction results.
[0012] In a possible implementation, the spatial feature data is enhanced by spatiotemporal feature embedding to obtain spatiotemporal embedding features, including: Construct preliminary spatiotemporal series data based on spatial feature data; The preliminary spatiotemporal sequence data is split into spatial dimensions to obtain a spatial embedding tensor, and the preliminary spatiotemporal sequence data is split into temporal dimensions to obtain a temporal embedding tensor; The spatial embedding tensor and the temporal embedding tensor are merged into the preliminary spatiotemporal sequence data to obtain the spatiotemporal embedding features.
[0013] On the other hand, the present invention also provides a vessel traffic flow prediction device, comprising: A track repair unit is used to obtain the ship track data of the port to be detected, and perform track repair on the ship track data to obtain repaired track data; A data clustering unit, used for performing direction recognition trajectory clustering on the repair trajectory data to obtain trajectory clustering data, and performing density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data; The prediction output unit is used to extract spatiotemporal features of node clustering data and output predictions to obtain ship traffic flow prediction results.
[0014] On the other hand, the present invention also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the above-mentioned ship traffic flow prediction method is implemented.
[0015] On the other hand, the present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the above-mentioned ship traffic flow prediction method is implemented.
[0016] The beneficial effects of the present invention are as follows: in the ship traffic flow prediction method provided by the present invention, the ship trajectory data of the port to be detected is firstly obtained, and the ship trajectory data is subjected to bidirectional trajectory prediction and repair to obtain the repaired trajectory data; then the repaired trajectory data is subjected to direction recognition trajectory clustering to obtain trajectory clustering data, and the trajectory clustering data is subjected to density adaptive parameter node clustering to obtain node clustering data; finally, the node clustering data is subjected to spatiotemporal feature extraction and prediction output to obtain the ship traffic flow prediction result. The present invention ensures the integrity of the ship trajectory data through bidirectional trajectory prediction and repair, mines the trajectory direction information while clustering the trajectory through direction recognition trajectory clustering, and mines the node comprehensive information while clustering the nodes through density adaptive parameter node clustering, which can effectively integrate the data while retaining the dynamic transformation information and deep-level relationships, thereby improving the accuracy of the ship traffic flow prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 A schematic diagram of a flow chart of an embodiment of a method for predicting ship traffic flow provided by the present invention; Figure 2 A schematic diagram of a process of bidirectional trajectory prediction and repair according to an embodiment of the present invention; Figure 3 A schematic diagram of the process of direction recognition trajectory clustering according to an embodiment of the present invention; Figure 4 A schematic diagram of the process of density adaptive parameter node clustering according to an embodiment of the present invention; Figure 5 A schematic diagram of a flow chart of local density evaluation according to an embodiment of the present invention; Figure 6 A schematic diagram of the process of spatiotemporal feature extraction and prediction output according to an embodiment of the present invention; Figure 7 A schematic diagram of a process of embedding and enhancing spatiotemporal features according to an embodiment of the present invention; Figure 8 A schematic diagram of the structure of an embodiment of a vessel traffic flow prediction device provided by the present invention; Fig. 9 A schematic structural diagram of an embodiment of an electronic device provided by the present invention. DETAILED DESCRIPTION
[0019] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0020] In the description of the embodiments of the present invention, unless otherwise specified, "multiple" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" may mean: A exists alone, A and B exist at the same time, and B exists alone.
[0021] The descriptions of "first" and "second" in the embodiments of the present invention are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the technical features defined as "first" and "second" may explicitly or implicitly include at least one of the features.
[0022] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0023] The present invention provides a method, device, electronic device and storage medium for predicting ship traffic flow, which are described below respectively.
[0024] Figure 1 A schematic diagram of a flow chart of an embodiment of a method for predicting ship traffic flow provided by the present invention is shown in FIG. Figure 1 As shown, the ship traffic flow prediction method includes: S101, obtaining the ship trajectory data of the port to be detected, and performing bidirectional trajectory prediction and repair on the ship trajectory data to obtain repaired trajectory data; S102, performing direction recognition trajectory clustering on the repair trajectory data to obtain trajectory clustering data, and performing density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data; S103, extracting spatiotemporal features of the node clustering data and outputting predictions to obtain ship traffic flow prediction results.
[0025] Compared with the prior art, the ship traffic flow prediction method provided by the embodiment of the present invention first obtains the ship trajectory data of the port to be detected, performs two-way trajectory prediction and 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, the spatiotemporal feature extraction and prediction output of the node clustering data are performed to obtain the ship traffic flow prediction result. The present invention ensures the integrity of the ship trajectory data through two-way trajectory prediction and repair, mines the trajectory direction information while clustering the trajectory through direction recognition trajectory clustering, and mines the node comprehensive information while clustering the nodes through density adaptive parameter node clustering. It can effectively integrate the data while retaining the dynamic transformation information and deep-level relationships, thereby improving the accuracy of ship traffic flow prediction.
[0026] In some embodiments of the present invention, Figure 2 FIG. 1 is a flow chart of a bidirectional trajectory prediction and repair process according to an embodiment of the present invention. Figure 2 As shown, the ship trajectory data is subjected to bidirectional trajectory prediction and repair to obtain repaired trajectory data, including: S201, inputting the ship trajectory data into a preset bidirectional long short-term memory network, performing a forward hidden layer sequence analysis on the ship trajectory data to obtain a forward hidden state vector, performing a reverse hidden layer sequence analysis on the ship trajectory data to obtain a reverse hidden state vector, and splicing and merging the forward hidden state vector and the reverse hidden state vector to obtain a bidirectional hidden state vector; S202, extracting attention from the bidirectional hidden state vector to obtain an attention context vector; S203, concatenating the bidirectional hidden state vector and the attention context vector to obtain an attention enhancement vector; S204, performing output layer prediction on the attention enhancement vector to obtain trajectory prediction output; S205. Fill missing values in the ship trajectory data according to the trajectory prediction output to obtain repaired trajectory data.
[0027] 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.
[0028] Among them, LSTM solves the gradient vanishing and gradient exploding problems 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 to effectively process time series data.
[0029] In LSTM, memory cells enable the LSTM network to pass information across steps in the time series, solving the gradient vanishing problem. The forget gate determines which information should be deleted from the memory cell. The input gate is responsible for controlling the addition of new information, including data input and update. It supplements information after the forget gate is filtered, and determines the new output through the combination of Sigmoid and Tanh functions.
[0030] The calculation formula of the forget gate is as follows:
[0031] The forget gate passes through the input and the hidden state passed from the previous layer Calculate, where and is the weight information. Calculation result The value is between 0 and 1, 0 means No information at the moment is retained, 1 means all information is retained.
[0032] The input gate calculation formula is expressed as:
[0033]
[0034] Cell information at the last moment and candidate cell information at past times The cell information at the current moment is updated through the following formula , input into the hidden layer at the next moment:
[0035] The output gate determines what information is output in the current time step. The output gate is mainly responsible for determining the value that enters the next hidden state.
[0036] After the cell state is updated, the final output is calculated by the following formula :
[0037]
[0038] The bidirectional long short-term memory network BiLSTM is an extension of LSTM. It combines the previous and next information processing sequences and enhances the ability to capture sequence context through forward and backward processing, thereby improving the model's understanding and prediction performance.
[0039] BiLSTM analyzes the forward and reverse sequences through two independent hidden layers, and finally outputs the predicted value Determined by the forward and reverse hidden layers.
[0040] Among them, the output of the forward hidden layer is:
[0041] The output of the reverse hidden layer is:
[0042] Among them, in the forward hidden layer formula is the hidden layer output weight of the forward propagation unit, is the weight of the state quantity from the previous moment to the current moment in the forward propagation, is the hidden layer state output value at the previous moment of forward propagation, is the bias term for forward propagation, and the parameters corresponding to the reverse hidden layer formula are the parameters for back propagation.
[0043] The attention mechanism is a technology used in machine learning to quantify the importance of information, and is widely used in natural language processing, image recognition, speech recognition and other fields. It determines the relative importance of information items to the task through three components: query matrix (Query), key (Key) and value (Value).
[0044] The attention mechanism quantifies the importance of information through keywords (K), weight values (V), data sources (S), queries (Q), and attention values (A). Each data source element is a key-value pair. ,in is a keyword, is the weight associated with the similarity of query Q. By weighting And sum up to get the result A. The attention mechanism is essentially the sum of the weighted data source elements, which can be expressed by the formula:
[0045] in, is the length of the input data. The calculation of the attention value can be divided into three stages: In the first stage, the correlation between the query and different keys is calculated, that is, the weight coefficients of different values are calculated, which can be expressed as follows:
[0046]
[0047]
[0048] Among the three similarity calculation methods, the first one uses dot product to calculate the similarity between Q and K, the second one uses Cosine similarity, and obtains a normalized score from -1 to 1 by dividing the dot product by the norm product, and the third one uses a neural network to automatically learn feature weights and generate a similarity score.
[0049] In the second stage, the output of the previous stage is normalized to map the range of values to between 0 and 1:
[0050] In this way, the raw correlations can be converted into normalized attention weights, which can be used to compute weighted averages or weighted sums to obtain weighted representations of different elements in the input sequence.
[0051] In the third stage, the Value is weighted and summed according to the weight coefficient to obtain the final attention value. The formula is expressed as:
[0052] In the process of predicting missing values of ship trajectory data, by combining the above method, 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 feature of each input time step, thereby guiding the network to focus on the most important part of the sequence data for the current task.
[0053] The embodiment first generates a hidden state vector through a bidirectional long short-term memory network, and the BiLSTM network generates a forward hidden state vector through its two hidden layers, forward and backward. and the reverse hidden state vector The final state vector is the concatenation or weighted sum of the two:
[0054] In the attention calculation, the hidden state vector set of the BiLSTM output sequence is obtained After that, the attention mechanism assigns a weight to the hidden state vector of each time step by calculating the query, key, and value. The specific steps are as follows: First, the query vector is generated using the target task context , then the hidden state vector set Used as key and value, query calculation and each key Similarity , use the softmax function to normalize the similarity into weights :
[0055] Then according to the normalized weight , for each hidden state vector The values of are weighted summed to obtain the attention context vector :
[0056] Context vector It represents the most important information in the input sequence for the current task.
[0057] Then the attention context vector The global hidden state after concatenation with the BILSTM hidden state Combined into an attention enhancement vector , and used in the prediction task to obtain the trajectory prediction output.
[0058] Finally, according to the obtained trajectory prediction output, the missing values of the initial ship trajectory data are filled to obtain the repaired trajectory data.
[0059] In some embodiments of the present invention, Figure 3 FIG. 1 is a flow chart of the direction recognition trajectory clustering process according to an embodiment of the present invention. Figure 3 As shown, the repair trajectory data is clustered by direction recognition trajectory to obtain trajectory clustering data, including: S301, performing similarity evaluation on the repair trajectory data based on the improved Hamming distance for direction recognition to obtain trajectory similarity; S302 : Clustering the repair trajectory data according to trajectory similarity to obtain trajectory clustering data.
[0060] Specifically, considering that the trajectory data provided by the AIS system is usually obtained from a variety of sensors, the data types are complex and diverse, and the data volume is large, clustering is required to reduce the amount of data processing. 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 in this process, and to improve the accuracy of subsequent traffic flow prediction, the embodiment uses direction recognition trajectory clustering and density adaptive parameter node clustering to cluster trajectories and nodes in turn.
[0061] In the process of trajectory clustering, traditional trajectory clustering methods include Euclidean distance, DTW (Dynamic Time Warping), Fréchet distance and Hamming distance, etc., each of which has its own applicable scenarios. In the embodiment of the present invention, considering the characteristics of trajectory data, an improved Hamming distance algorithm is used for trajectory clustering.
[0062] The traditional Hamming distance evaluates similarity by calculating the maximum and minimum distances, which can capture shape differences, but is affected by outliers and cannot distinguish directions, affecting the clustering effect. Its formula is:
[0063] in, and Represent two trajectories, represents the Euclidean distance.
[0064] The traditional Hamming distance mainly considers the maximum distance between points, ignoring the overall shape and directionality of the trajectory. To overcome this limitation, the method proposed in the embodiment not only calculates the shortest distance from a point to a line segment between trajectories, but also introduces directional sensitivity, making the metric more in line with the actual application requirements of trajectory data.
[0065] Combining the trajectory segment distance calculation and direction identification mechanism, the improved Hamming distance formula for direction identification in the embodiment is:
[0066] in, is an adjustment function based on the direction cosine value, defined as:
[0067] Among them, here It is usually greater than 1, which is used to increase the distance between trajectories with opposite directions and reduce their similarity scores. This method quantifies the spatial and directional properties of trajectories and provides a more refined and adaptable similarity measure for trajectory clustering.
[0068] In some embodiments of the present invention, Figure 4 FIG. 1 is a flow chart of density adaptive parameter node clustering according to an embodiment of the present invention. Figure 4 As shown, the trajectory clustering data is subjected to density adaptive parameter node clustering to obtain node clustering data, including: S401, performing local density evaluation on the trajectory clustering data to obtain the local density of each node in the trajectory clustering data; S402, dividing 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; S403, determining high-density clustering parameters of high-density areas and low-density clustering parameters of low-density areas according to local density; S404, clustering the high-density area according to the high-density clustering parameter to obtain high-density clustering data, and clustering the low-density area according to the low-density clustering parameter to obtain low-density clustering data; S405: Merge high-density data and low-density data to obtain node clustering data.
[0069] In some embodiments of the present invention, Figure 5 FIG. 4 is a flow chart of local density evaluation according to an embodiment of the present invention. Figure 5 As shown in Figure 1, the local density of each node in the trajectory clustering data is evaluated by local density evaluation, including: S501, performing a comprehensive distance evaluation on each node and the corresponding neighboring nodes in the trajectory clustering data based on the improved Hausdorff distance to obtain a comprehensive distance of the neighboring nodes of each node; S502, determining the local density of each node according to the comprehensive distance of adjacent nodes; Among them, the comprehensive distance assessment includes position distance assessment, direction difference assessment and speed difference assessment.
[0070] Specifically, in the node clustering process, the traditional point clustering method is DBSCAN (Density-Based Spatial Clustering of Applications with Noise), which can perform clustering based on density points. However, considering the characteristics of node distribution in trajectory data, for example, in areas close to ports, route nodes are more densely distributed, and in areas far from ports, route nodes are more sparsely distributed. The existing DBSCAN has limitations in processing multi-density route nodes. For this reason, the embodiment provides a density adaptive parameter node clustering method, dynamically adjusts clustering parameters to adapt to data density changes, and uses local density measurement to optimize parameter selection, which overcomes the limitations of traditional DBSCAN fixed global parameters and improves flexibility.
[0071] First, the embodiment needs to determine the local density process of each part of the node, considering that the nodes in the trajectory data are not just simple location points, but also include information such as speed and heading. In this regard, the embodiment evaluates the local density of the node by improving the Hausdorff distance, comprehensively considering the position, heading and speed, effectively adapting to complex density distribution, and is particularly suitable for cluster analysis of dynamic ship trajectory data.
[0072] For each point in the data set , first determine its nearest neighbor nodes and calculate the point The distance to these neighboring nodes includes the evaluation of position distance, direction difference, and speed difference. The distance formula is as follows:
[0073] in, and Indicate point The coordinates of Indicate point The direction of Indicate point Speed, weight and Controls the contribution of heading and speed differences to the total distance.
[0074] The embodiment then uses these distances to calculate the point The local density , the density is obtained by The distances of the nearest neighbors are summed and the inverse is taken to estimate:
[0075] The embodiment reflects the density around the point through this formula. The higher the density value, the more or closer the surrounding neighbors are. In this way, we can provide a quantitative density assessment for each point in the data set, which is the basis for subsequent parameter adjustment and clustering decision.
[0076] Based on the local density of each point, density-adaptive parameter node clustering can dynamically adjust clustering parameters. This adjustment is to enable the algorithm to adapt to the density inhomogeneity within the data set and improve the accuracy and flexibility of clustering.
[0077] Based on the evaluation of local density, the embodiment sets a global density threshold To distinguish high-density and low-density areas. For points located in high-density areas (i.e. ), the embodiment reduces the neighborhood radius And increase the minimum number of neighbors , to prevent over-aggregation and ensure that only truly dense areas form clusters:
[0078]
[0079] Conversely, for points located in low-density regions (i.e., ρ(p) ≤ θ), we increase the neighborhood radius And reduce the minimum number of neighbors , in order to connect sparsely distributed points:
[0080]
[0081] Density adaptive parameter node clustering dynamically adjusts parameters to adapt to different density areas, maintains clustering quality, and effectively identifies and separates clusters, which is its key advantage in processing complex data sets. The embodiment divides the trajectory clustering data into high-density areas and low-density areas, and then uses different adaptive clustering parameters for clustering, and merges the clustering results to obtain node clustering data.
[0082] In some embodiments of the present invention, Figure 6 FIG. 1 is a flow chart of spatiotemporal feature extraction and prediction output according to an embodiment of the present invention. Figure 6 As shown in the figure, the spatiotemporal feature extraction and prediction output of the node clustering data are performed to obtain the ship traffic flow prediction results, including: S601, performing Chebyshev convolution on the node clustering data to obtain spatial feature data; S602, performing spatiotemporal feature embedding enhancement on the spatial feature data to obtain spatiotemporal embedding features; S603, performing dilated causal convolution and gated temporal convolution on the spatiotemporal embedding features in sequence to obtain traffic flow features; S604: predict and output the traffic flow characteristics to obtain a ship traffic flow prediction result.
[0083] Specifically, the graph neural network model 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 spatiotemporal embedding module for feature enhancement, and a gated temporal convolutional network for extracting temporal features. They are combined into multiple spatiotemporal graph convolutional modules and connected through residual connections to achieve effective fusion of temporal and spatial characteristics of ship traffic flow, and the obtained traffic flow characteristics are predicted and output to obtain accurate ship traffic flow prediction results.
[0084] In route network traffic flow prediction, route network data comes from sensors at different locations. The traffic volumes of these sensors affect each other and are suitable for representation by graph structures. The graph is defined as ,in is a node set, For edge sets.
[0085] In existing research, the spatial distance between nodes in a transportation network is usually used to construct its topological structure. The adjacency matrix is constructed as follows: With Node The distance is greater than the threshold and When , the corresponding element in the adjacency matrix is set to 1, which can be expressed as:
[0086] The method of constructing an adjacency matrix based on distance values is simple, intuitive and easy to operate, but there are also some problems. There may be correlations between nodes that are far away, that is, the size of the distance value between two nodes does not necessarily reflect the adjacency relationship between the two nodes.
[0087] In this regard, GCN can better handle non-Euclidean structure data such as traffic network topology. By using graph convolutional networks, it can accurately extract the topological relationship between nodes and their surrounding nodes, thereby more effectively capturing the spatial characteristics of traffic data. In graph convolutional networks, the topological structure can be represented by the Laplacian matrix, and its standard form is defined as:
[0088] in, is the identity matrix with all diagonal elements set to 1, is the adjacency matrix of the graph, is a diagonal matrix consisting of the degrees of the nodes, It can be broken down into:
[0089] Is The matrix composed of the eigenvectors of is its eigenvalue diagonal matrix. The graph convolution calculation formula can be expressed as:
[0090] in, represents the convolution of two signals, and express and The Fourier transform of the graph is Denotes the Hadamard product. According to the commutative law of multiplication, let , we can further get the formula:
[0091] However, although the frequency domain method of graph convolution can realize graph signal convolution, it has high computational complexity and mainly captures first-order neighbor relationships, which does not fully utilize the local properties of the graph. To solve these problems, the embodiment introduces the Chebyshev convolutional network. order Chebyshev polynomial to approximate the convolution kernel :
[0092] in, , represents the maximum eigenvalue of the Laplace matrix, and the Chebyshev polynomial is defined as , are the polynomial coefficients, , , through the polynomial The computational complexity can be effectively reduced by the number of iterations.
[0093] Then the embodiment uses gated temporal convolution and dilated causal convolution technology to extract the temporal characteristics of traffic flow. By increasing the number of layers, the receptive field is expanded and the temporal dependency is effectively captured. Compared with RNN, TCN avoids the cyclic structure, is more efficient and reduces the risk of gradient explosion. In the dilated causal convolution process, given the input sequence , dilated convolution operation It can be defined as:
[0094] in, represents the dilated convolution operator, is the sequence length, is the expansion parameter, is the convolution kernel size.
[0095] Temporal convolution TCN sets residual units and uses the concatenation of identity mapping and residual mapping to maintain the optimal state of the network and avoid gradient disappearance and explosion.
[0096] In order to solve the problem that TCN cannot effectively capture the long-term dependency of time series features, we consider adding a gating mechanism to TCN, combining the temporal convolution operation with the gating unit to obtain a gated TCN, so as to better capture the long-term dependency in time series data. By controlling the flow of information through the gating unit, the network's modeling ability for time series data can be improved, which is especially suitable for processing long sequence data.
[0097] In the gated TCN layer, for a given input data , output ,in and For two different convolution operations, the two activation functions control the retention and forgetting of information respectively.
[0098] In some embodiments of the present invention, Figure 7 FIG. 1 is a flow chart of the spatiotemporal feature embedding enhancement process of an embodiment of the present invention. Figure 7 As shown in the figure, the spatial feature data is embedded with spatiotemporal features to obtain spatiotemporal embedding features, including: S701, constructing preliminary spatiotemporal sequence data according to spatial feature data; S702, splitting the preliminary spatiotemporal sequence data into spatial dimensions to obtain a spatial embedding tensor, and splitting the preliminary spatiotemporal sequence data into temporal dimensions to obtain a temporal embedding tensor; S703, merge the spatial embedding tensor and the temporal embedding tensor into the preliminary spatiotemporal sequence data to obtain spatiotemporal embedding features.
[0099] Specifically, the embodiment takes into account that although GCN effectively extracts the spatial features of traffic flow, it does not fully consider the information of the time dimension. In order to further enhance the network's ability to recognize features, the embodiment adds a spatiotemporal embedding module between the spatial graph convolutional network and the gated temporal convolutional network to embed and enhance the features.
[0100] The embodiment first constructs a spatiotemporal sequence based on the graph structure data output by the graph convolution layer, wherein 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 temporal and spatial dependencies of traffic flow are captured.
[0101] For the input space-time sequence ,in is the number of nodes, is the feature dimension, is the number of time steps. Split into embedding tensors along the spatial dimension , and then split into embedding tensors along the time dimension , and then use a 1×1 convolution operation to process these two embedding tensors to ensure that they contain the necessary spatiotemporal information. Finally, these embedding tensors are added to the spatiotemporal sequence through the broadcast mechanism to obtain a new spatiotemporal sequence As the input of the next layer of gated temporal convolutional network.
[0102] 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, performs two-way trajectory prediction and 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, the node clustering data is subjected to spatiotemporal feature extraction and prediction output to obtain the ship traffic flow prediction result. The present invention ensures the integrity of the ship trajectory data through two-way trajectory prediction and repair, mines the trajectory direction information while clustering the trajectory through direction recognition trajectory clustering, and mines the node comprehensive information while clustering the nodes through density adaptive parameter node clustering. It can effectively integrate the data while retaining the dynamic transformation information and deep-level relationships, thereby improving the accuracy of ship traffic flow prediction.
[0103] In order to better implement the ship traffic flow prediction method in the embodiment of the present invention, based on the ship traffic flow prediction method, correspondingly, Figure 8 As shown, the present invention also provides a ship traffic flow prediction device, the ship traffic flow prediction device 800 comprises: The track repair unit 801 is used to obtain the ship track data of the port to be detected, and perform track repair on the ship track data to obtain repaired track data; The data clustering unit 802 is used to perform direction recognition trajectory clustering on the repair trajectory data to obtain trajectory clustering data, and perform density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data; The prediction output unit 803 is used to extract spatiotemporal features of the node clustering data and perform prediction output to obtain a ship traffic flow prediction result.
[0104] The ship traffic flow prediction device 800 provided in the above embodiment can implement the technical solution described in the above ship traffic flow prediction method embodiment. The specific implementation principles of the above modules or units can refer to the corresponding contents in the above ship traffic flow prediction method embodiment, which will not be repeated here.
[0105] like Fig. 9 As shown, the present invention also provides an electronic device 900. The electronic device 900 includes a processor 901, a memory 902 and a display 903. Fig. 9 Only some components of the electronic device 900 are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0106] In some embodiments, the processor 901 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run program codes or process data stored in the memory 902, such as the ship traffic flow prediction method of the present invention.
[0107] 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 in 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 thereof.
[0108] In some embodiments, the memory 902 may be an internal storage unit of the electronic device 900, such as a hard disk or memory of the electronic device 900. In other embodiments, the memory 902 may also be an external storage device of the electronic device 900, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc., equipped on the electronic device 900.
[0109] Furthermore, the memory 902 may include both an internal storage unit of the electronic device 900 and an external storage device. The memory 902 is used to store application software installed in the electronic device 900 and various data.
[0110] In some embodiments, the display 903 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 903 is used to display 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 a system bus.
[0111] In one embodiment, when the processor 901 executes the ship traffic flow prediction program in the memory 902, the following steps may be implemented: 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; Direction recognition trajectory clustering is performed on the repair 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; The spatiotemporal features of node clustering data are extracted and predicted to obtain the ship traffic flow prediction results.
[0112] 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 details, please refer to the description of the corresponding method embodiment above.
[0113] Accordingly, an embodiment of the present application also provides a computer-readable storage medium, which is used to store computer-readable programs or instructions. When the program or instructions are executed by a processor, the steps or functions in the ship traffic flow prediction method provided by the above-mentioned method embodiments can be implemented.
[0114] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related 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, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0115] The ship traffic flow prediction method, device, electronic device and storage medium provided by the present invention are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for predicting ship traffic flow, characterized in that: include: Acquire ship trajectory data of the port to be detected, and perform bidirectional trajectory prediction and repair on the ship trajectory data to obtain repaired trajectory data; Performing direction recognition trajectory clustering on the repair trajectory data to obtain trajectory clustering data, and performing density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data; The node clustering data is subjected to spatiotemporal feature extraction and prediction output to obtain a ship traffic flow prediction result.
2. The ship traffic flow prediction method according to claim 1, characterized in that: The performing bidirectional trajectory prediction and repair on the ship trajectory data to obtain repaired trajectory data includes: Inputting the ship trajectory data into a preset bidirectional long short-term memory network, performing a forward hidden layer sequence analysis on the ship trajectory data to obtain a forward hidden state vector, performing a reverse hidden layer sequence analysis on the ship trajectory data to obtain a reverse hidden state vector, and splicing and merging the forward hidden state vector and the reverse hidden state vector to obtain a bidirectional hidden state vector; Performing attention extraction on the bidirectional hidden state vector to obtain an attention context vector; Concatenating the bidirectional hidden state vector and the attention context vector to obtain an attention enhancement vector; Performing output layer prediction on the attention enhancement vector to obtain a trajectory prediction output; The missing values of the ship trajectory data are filled 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 repair trajectory data to obtain trajectory clustering data includes: Performing similarity evaluation on the repaired trajectory data based on the direction recognition improved Hamming distance to obtain trajectory similarity; The repair trajectory data is clustered according to the trajectory similarity to obtain trajectory clustering data.
4. The ship traffic flow prediction method according to claim 1, characterized in that: The performing density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data includes: Performing local density evaluation on the trajectory clustering data to obtain the local density of each node in the trajectory clustering data; Dividing 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; Determining 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; Performing clustering processing on the high-density area according to the high-density clustering parameters to obtain high-density clustering data, and performing clustering processing on the low-density area according to the low-density clustering parameters to obtain low-density clustering data; The high-density data and the low-density data are combined to obtain node clustering data.
5. The ship traffic flow prediction method according to claim 4, characterized in that: The performing local density evaluation on the trajectory clustering data to obtain the local density of each node in the trajectory clustering data includes: Based on the improved Hausdorff distance, a comprehensive distance evaluation is performed on each node and the corresponding neighboring nodes in the trajectory clustering data to obtain a comprehensive distance of the neighboring nodes of each node; Determine the local density of each node according to the comprehensive distance of the neighboring nodes; The comprehensive distance assessment includes position distance assessment, direction difference assessment and speed difference assessment.
6. The method for predicting ship traffic flow according to claim 1, characterized in that: The extracting and predicting the spatiotemporal features of the node clustering data to obtain the ship traffic flow prediction result includes: Performing Chebyshev convolution on the node clustering data to obtain spatial feature data; Performing spatiotemporal feature embedding enhancement on the spatial feature data to obtain spatiotemporal embedding features; The spatiotemporal embedding features are sequentially subjected to dilated causal convolution and gated temporal convolution to obtain traffic flow features; The traffic flow characteristics are predicted and output to obtain a ship traffic flow prediction result.
7. The ship traffic flow prediction method according to claim 1, characterized in that: The step of performing spatiotemporal feature embedding enhancement on the spatial feature data to obtain spatiotemporal embedding features includes: constructing preliminary spatiotemporal series data according to the spatial feature data; Splitting the preliminary spatiotemporal sequence data into spatial dimensions to obtain a spatial embedding tensor, and splitting the preliminary spatiotemporal sequence data into temporal dimensions to obtain a temporal embedding tensor; The spatial embedding tensor and the temporal embedding tensor are incorporated into the preliminary spatiotemporal sequence data to obtain spatiotemporal embedding features.
8. A vessel traffic flow prediction device, characterized in that: include: A track repair unit, used for acquiring ship track data of the port to be detected, and performing track repair on the ship track data to obtain repaired track data; A data clustering unit, configured to perform direction recognition trajectory clustering on the repair trajectory data to obtain trajectory clustering data, and perform density adaptive parameter node clustering on the trajectory clustering data to obtain node clustering data; The prediction output unit is used to extract the spatiotemporal features of the node clustering data and output the prediction to obtain the ship traffic flow prediction result.
9. An electronic device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the ship traffic flow prediction method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the ship traffic flow prediction method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Clustering method based on mobile object spatiotemporal information trajectory subsections
CN103593430A
Traffic flow prediction method for checkpoint similarity division and recurrent neural network
CN109767622A
Road intersection position and coverage area detection frame method based on floating car track
CN111291144A
Adaptive space-time trajectory clustering method based on density peak value
CN112070179A
Ship traffic flow prediction method based on improved graph convolutional neural network
CN114565124A
Cited By
Intelligent traffic monitoring system based on big data
CN120510714A
A smart traffic monitoring system based on big data
CN120510714B
Terminal space-time trajectory data retrieval method and device, equipment and storage medium
CN121935392A