Ship traffic flow prediction method and device, electronic equipment and readable storage medium
By applying the STMGCN model in marine traffic flow prediction, the multi-graph features of the maritime traffic network are constructed and the time convolution network is combined with the problem of difficulty in capturing the correlation between long-distance regions in the prior art, which significantly improves the accuracy and efficiency of prediction.
Patent Information
- Application Number
- CN202510309289.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-17
- Publication Date
- 2025-04-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to effectively capture the correlation between long-distance areas in marine traffic flow, resulting in insufficient accuracy of marine traffic flow prediction.
The method based on space-time multi-graph convolutional neural network (STMGCN) is adopted to describe the spatial correlation between nodes in the maritime traffic network by constructing distance graphs, interaction graphs and dynamic attention graphs, and to extract temporal features in combination with the time convolution network, and fuse spatiotemporal features to generate prediction results.
The potential temporal and spatial correlation in ship traffic flow is effectively captured, the accuracy of prediction results is improved, and the complexity of sea ship traffic flow prediction is solved, especially for time series prediction problems with highly dynamic and nonlinear characteristics.
Smart Images

Figure CN119831177A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of water transport traffic flow prediction, and specifically to a ship traffic flow prediction method, device, electronic device and readable storage medium. Background Art
[0002] Accurately predicting ocean traffic flow plays an important role in maritime transport, including: providing conditions for tasks such as ship scheduling and route planning, thereby improving the efficiency and reliability of the maritime transport system; port operators and ship operators can adjust the ship's entry and departure plans based on forecast data, effectively manage port resources, reduce the waiting time of ships in ports, and optimize cargo loading and unloading efficiency; reduce port congestion and improve the smoothness and reliability of the maritime logistics chain; manage ship fuel consumption and emissions, reduce empty and roundabout sailing of ships, thereby reducing fuel consumption and greenhouse gas emissions, and supporting environmental sustainability; respond to extreme weather and maritime emergencies, predict and avoid possible risks and disasters in advance, and ensure the safety of ships and crew members.
[0003] Regarding traffic flow prediction, most of them focus on road vehicle traffic flow prediction. Traditional statistical methods (such as Kalman filter, ARIMA, VAR, SVR) rely on distribution assumptions and are sensitive to data noise. These simplified methods cannot capture nonlinear correlations, especially the complexity of spatial and temporal data. Existing traffic flow prediction models mainly focus on the correlation between adjacent areas in space, ignoring the correlation between distant areas. Compared with traditional methods, deep learning-based methods have better ability to learn nonlinear features, without prior distribution assumptions, and automatically extract nonlinear features from spatiotemporal data; long short-term memory networks (LSTM) and gated recurrent units (GRU) are used to capture temporal dependencies; convolutional neural networks (CNN) and graph convolution (GCN) are used to extract spatial features.
[0004] Therefore, how to integrate existing deep learning techniques and comprehensively consider temporal, spatial, and nonlinear characteristics to design a prediction model that captures correlations between long-distance regions to improve the accuracy of marine traffic flow predictions is a technical problem that needs to be solved in this field. Summary of the invention
[0005] In view of the above problems, the present application provides a method, device, electronic device and readable storage medium for predicting ship traffic flow.
[0006] In order to solve the above technical problems, a technical solution adopted by the present invention is: to provide a method for predicting ship traffic flow, the method comprising: collecting historical ship traffic flow data provided by the ship automatic identification system AIS; performing time serialization and spatial dimension integration processing on the historical ship traffic flow data to construct a three-dimensional tensor of the ship traffic flow time series; performing feature encoding on the three-dimensional tensor of the ship traffic flow time series to extract features with representation capabilities; and extracting and fusing the time features and spatial features of the features with representation capabilities to generate a prediction result of the ship traffic flow.
[0007] The time and space features of the features with characterization capability are extracted and integrated to generate the prediction results of ship traffic flow, specifically including: using the first time convolutional network The input sequence is organized into features with characterization capabilities Perform convolution operation to get the output , to extract dynamic features; among them, l represents a temporal convolution layer, M represents the number of time steps, N Indicates the number of nodes at each time point; K represents the convolution kernel size of the temporal convolution, is the number of channels of input data, is the number of channels of the output data; a nonlinear activation function is applied to perform a first time gated convolution process on the extracted dynamic features, and key features are screened to obtain a key time series feature fusion matrix that integrates the key features; wherein the first time gated convolution is defined as in formula (2); represents two independent inputs to the nonlinear activation function, represents the Hadamard product, Represents the key time series feature fusion matrix; (2) By constructing and fusing the features of multiple spatial correlation graphs, a spatial fusion feature matrix is obtained; using the second temporal convolutional network The spatial fusion feature matrix is convolved again to extract dynamic features again; a nonlinear activation function is applied to the dynamic features extracted again to perform a second time gated convolution process, and key features are screened to obtain an enhanced time series prediction feature matrix that integrates the key features; wherein the second time gated convolution is defined as described in formula (8); represents two independent inputs of the nonlinear activation function, represents the enhanced time series prediction feature matrix; (8) The enhanced time series prediction feature matrix is transformed to generate a ship traffic flow prediction result; wherein the prediction result is .
[0008] The spatial fusion feature matrix is obtained by constructing and fusing the features of multiple spatial correlation graphs, which specifically includes: constructing multiple spatial correlation graphs using the features between two adjacent nodes in the maritime traffic network graph; wherein the spatial correlation graph includes a distance graph , Interaction diagram And dynamic attention map ; Performing different spatial correlation graph convolution operations on the input sequence to obtain corresponding feature matrices; and concatenating the feature matrices of different spatial correlation graphs to form the spatial fusion feature matrix; (6) (7) in, represents the feature matrix, W Represents the weight matrix, whose shape is C in × C out ; Representing spatial correlation graph G The corresponding adjacency matrix has the shape of M × N × N ; express ReLU Activation function; represents the feature matrix concatenation operation, Represents the spatial fusion feature matrix.
[0009] Among them, the features between two adjacent nodes in the maritime traffic network graph are used to construct multiple spatial correlation graphs, specifically including: using the inverse of the distance between two adjacent nodes in the maritime traffic network graph to construct an adjacency matrix, and extracting the distance graph through formula (3) ;in, Representation Node and The nautical mile distance between the centroids of is the adjacency matrix Elements of , representing nodes and The reciprocal of the distance between; (3) The adjacency matrix is constructed by using the historical navigation records between two adjacent nodes in the maritime traffic network graph, and the interaction graph is extracted using formula (4): ;in, ; Representation Node and The historical navigation records between is the adjacency matrix Elements, recorded by historical navigation constitute; (4) The adjacency matrix is constructed by calculating the attention score matrix of each time node in the maritime traffic network graph, and the dynamic attention graph is extracted by formula (5) ;in, ; is the attention score matrix Elements of , representing nodes and Attention score; (5)
[0010] In order to solve the above technical problems, another technical solution adopted by the present invention is: to provide a ship traffic flow prediction device, the device comprising: a data collection and processing unit, used to collect historical ship traffic flow data provided by the ship automatic identification system AIS; a traffic flow data organization unit, used to time serialize and integrate the historical ship traffic flow data in spatial dimensions to construct a three-dimensional tensor of the ship traffic flow time series; a feature extraction and encoding unit, used to feature encode the three-dimensional tensor of the ship traffic flow time series and extract features with representation capabilities; a spatiotemporal multi-graph convolution unit, used to extract and fuse the temporal features and spatial features of the features with representation capabilities to generate a fused feature matrix; and an output layer transformation unit, used to transform the fused feature matrix output by the spatiotemporal multi-graph convolution unit to generate and output the prediction result of the ship traffic flow.
[0011] The spatiotemporal multi-graph convolution unit includes: a first time convolution module, which is used to: use a first time convolution network The input sequence is organized into features with characterization capabilities Perform convolution operation to get the output , to extract dynamic features; among them, l represents a temporal convolution layer, M represents the number of time steps, N Indicates the number of nodes at each time point; K represents the convolution kernel size of the temporal convolution, is the number of channels of input data, is the number of channels of the output data; and a nonlinear activation function is applied to perform a first time gated convolution process on the extracted dynamic features, and key features are screened to obtain a key time series feature fusion matrix that integrates the key features; wherein the first time gated convolution is defined as in formula (2); represents two independent inputs to the nonlinear activation function, represents the Hadamard product, Represents the key time series feature fusion matrix; (2) The spatial multi-graph convolution module is used to obtain a spatial fusion feature matrix by constructing and fusing the features of multiple spatial correlation graphs; the second temporal convolution module is used to: use the second temporal convolution network The spatial fusion feature matrix is convolved again to extract dynamic features again; and the dynamic features extracted again are subjected to a second time gated convolution process by applying a nonlinear activation function to screen key features to obtain an enhanced time series prediction feature matrix fused with the key features; wherein the second time gated convolution is defined as described in formula (8); represents two independent inputs of the nonlinear activation function, represents the enhanced time series prediction feature matrix; (8) The output layer transformation unit is further used to transform the enhanced time series prediction feature matrix to generate a ship traffic flow prediction result; wherein the prediction result is .
[0012] The spatial multi-graph convolution module is further used to: construct multiple spatial correlation graphs using the features between two adjacent nodes in the maritime traffic network graph; wherein the spatial correlation graphs include distance graphs , Interaction diagram And dynamic attention map ; Performing different spatial correlation graph convolution operations on the input sequence to obtain corresponding feature matrices; and concatenating the feature matrices of different spatial correlation graphs to form the spatial fusion feature matrix; (6) (7) in, represents the feature matrix, W Represents the weight matrix, whose shape is C in × C out ; Representing spatial correlation graphG The corresponding adjacency matrix has the shape of M × N × N ; express ReLU Activation function; represents the feature matrix concatenation operation, Represents the spatial fusion feature matrix.
[0013] The spatial multi-graph convolution module is further used to: construct an adjacency matrix using the inverse of the distance between two adjacent nodes in the maritime traffic network graph, and extract the distance graph using formula (3): ;in, Representation Node and The nautical mile distance between the centroids of is the adjacency matrix Elements of , representing nodes and The reciprocal of the distance between; (3) The adjacency matrix is constructed by using the historical navigation records between two adjacent nodes in the maritime traffic network graph, and the interaction graph is extracted using formula (4): ;in, ; Representation Node and The historical navigation records between is the adjacency matrix Elements, recorded by historical navigation constitute; (4) The adjacency matrix is constructed by calculating the attention score matrix of each time node in the maritime traffic network graph, and the dynamic attention graph is extracted by formula (5) ;in, ; is the attention score matrix Elements of , representing nodes and Attention score; (5).
[0014] In order to solve the above technical problems, another technical solution adopted by the present invention is: to provide an electronic device, including: a processor and a memory, the memory is used to store computer program code, the computer program code includes computer instructions, when the processor executes the computer instructions, the electronic device executes the steps of the ship traffic flow prediction method as described above.
[0015] In order to solve the above technical problems, another technical solution adopted by the present invention is: providing a readable storage medium, in which a computer program is stored. The computer program includes program instructions. When the program instructions are executed by a processor of an electronic device, the processor executes the steps of the ship traffic flow prediction method as described above.
[0016] The present invention provides a method, device, electronic device and readable storage medium for predicting ship traffic flow. The STMGCN model is used to construct a distance graph, an interaction graph and a dynamic attention graph to describe the spatial correlation between nodes in the maritime traffic network, taking into account the inter-dependence and spatial heterogeneity of complex maritime traffic dynamics, and effectively capturing the potential time and space correlation in the ship traffic flow. Through this capture, the model can understand and predict the trend and pattern of flow changes, thereby improving the accuracy of the prediction results; and solves the complexity of predicting maritime ship traffic flow, especially for time series prediction problems with highly dynamic and nonlinear characteristics; through the ship traffic flow prediction method, it is of great significance to improve the efficiency of maritime traffic management, optimize route planning and enhance maritime traffic safety. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a flow chart of a method for predicting ship traffic flow provided by an embodiment of the present invention; Figure 2 yes Figure 1 A schematic diagram of a method flow chart of an embodiment of step S11; Figure 3 yes Figure 1 A method flow diagram of an embodiment of step S13; Figure 4 is a schematic diagram of a time-gated convolution structure provided by an embodiment of the present invention; Figure 5 yes Figure 3 A method flow diagram of an embodiment of step S132; Figure 6 yes Figure 1 A schematic diagram of a method flow chart of another embodiment of step S13; Figure 7 It is a schematic diagram of the module structure of a ship traffic flow prediction device provided by an embodiment of the present invention; Figure 8 yes Figure 7 A schematic diagram of the architecture of an embodiment of a vessel traffic flow prediction device; Fig. 9 yes Figure 7 A schematic diagram of a module structure of an embodiment of a spatiotemporal multi-graph convolution unit in FIG. Fig.10 yes Fig. 9A schematic diagram of the architecture of an embodiment of a spatiotemporal multi-graph convolution unit in FIG. Fig.11 It is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention.
[0018] Fig.12 It is the forecast result of ship traffic data in the waters near Denmark from 2019 to 2022; The reference numerals in the above drawings are described as follows: 30. Ship traffic flow prediction device; 31. Data collection and processing unit; 32. Traffic flow data organization unit; 33. Feature extraction and encoding unit; 34. Spatiotemporal multi-graph convolution unit; 340. First temporal convolution module; 341. Spatial multi-graph convolution module; 342. Second temporal convolution module; 343. Feature compression module; 35. Output layer transformation unit; 4. Electronic device; 41. Processor; 42. Memory; 43. Input device; 44. Output device; 45. Computer program; DETAILED DESCRIPTION
[0019] In order to explain in detail the possible application scenarios, technical principles, specific schemes that can be implemented, and the purposes and effects that can be achieved, the following is a detailed description of the specific embodiments listed in conjunction with the accompanying drawings. The embodiments described herein are only used to more clearly illustrate the technical solutions of the present application, and are therefore only used as examples, and cannot be used to limit the scope of protection of the present application.
[0020] Reference to "embodiment" herein means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present application. The term "embodiment" appearing in various places in the specification does not necessarily refer to the same embodiment, nor does it particularly limit its independence or association with other embodiments. In principle, in the present application, as long as there is no technical contradiction or conflict, the various technical features mentioned in the embodiments can be combined in any way to form a corresponding implementable technical solution.
[0021] Unless otherwise defined, the technical terms used in this document have the same meanings as those generally understood by those skilled in the art to which this application belongs; the use of relevant terms in this document is only for describing specific embodiments and is not intended to limit this application.
[0022] In the description of this application, the term "and / or" is an expression used to describe the logical relationship between objects, indicating that three relationships may exist, for example, A and / or B, which means: A exists, B exists, and A and B exist at the same time. In addition, the character " / " in this article generally indicates that the objects before and after are in an "or" logical relationship.
[0023] In the present application, terms such as “first” and “second” are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship of quantity, priority or sequence between these entities or operations.
[0024] Without further limitations, in this application, the words "include", "comprises", "has" or other similar open-ended expressions used in sentences are intended to cover non-exclusive inclusion. These expressions do not exclude the presence of additional elements in the process, method or product including the elements, so that the process, method or product including a series of elements may include not only those limited elements, but also other elements not explicitly listed, or also include elements inherent to such process, method or product.
[0025] Similar to the understanding in the Examination Guidelines, in this application, expressions such as "greater than", "less than", "exceed" and the like are understood to exclude the number itself; expressions such as "above", "below", "within" and the like are understood to include the number itself. In addition, in the description of the embodiments of this application, "multiple" means more than two (including two), and similar expressions related to "multiple" are also understood in this way, such as "multiple groups", "multiple times", etc., unless otherwise clearly and specifically limited.
[0026] In the description of the embodiments of the present application, space-related expressions used, such as "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "vertical", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc., indicate the orientation or position relationship based on the orientation or position relationship shown in the specific embodiments or drawings, and are only for the convenience of describing the specific embodiments of the present application or facilitating the reader's understanding, and do not indicate or imply that the referred device or component must have a specific position, a specific orientation, or be constructed or operated in a specific orientation, and therefore cannot be understood as a limitation on the embodiments of the present application.
[0027] The increasing ship traffic and complex maritime navigation environment require more advanced ship traffic prediction models to ensure maritime safety and maritime transportation efficiency. Regarding traffic flow prediction, most of the current research focuses on road vehicle traffic flow prediction. Early traffic network prediction models are mainly based on statistical methods, including Kalman filters, autoregressive integrated moving average (ARIMA) models, vector autoregression (VAR), and support vector regression (SVR). These models mainly rely on statistical assumptions to capture trends and periodic characteristics in historical data. However, these simplified methods rely on distribution assumptions, which makes them sensitive to data noise and unable to learn nonlinear correlations between spatial and temporal data. Compared with traditional methods, deep learning-based methods have better ability to learn nonlinear features. Deep learning-based models do not require prior distribution assumptions and can automatically and accurately extract nonlinear features from spatiotemporal data. Therefore, deep learning-based methods have become a major research trend in recent years. Some methods focus on temporal feature extraction; they mainly rely on long short-term memory networks (LSTM) or gated recurrent units (GRU) to capture temporal dependencies. In addition to temporal dependencies, spatial dependencies are also crucial. In terms of spatial feature extraction, some studies use methods such as convolutional neural networks (CNN) or graph convolution (GCN) to extract spatial features.
[0028] A deep understanding of the complex dynamics of maritime traffic requires a model that can parse the temporal and spatial dependencies contained in the data. Previous traffic flow prediction algorithms often regard the learning of temporal and spatial dependencies as a sequential relationship, but this method ignores the dependency between time and space, which often leads to the loss of some of the correlation between time and space during the learning process; at the same time, in the task of ship traffic flow prediction, maritime traffic has strong spatial heterogeneity, and the relationship between nodes is not relatively constant, but the spatial relationship between nodes changes with the season, cargo demand, etc. Therefore, a more accurate prediction of ship traffic flow requires considering both the spatial heterogeneity between nodes and the dependency between different nodes under different time conditions.
[0029] Based on this, this application proposes a ship traffic flow prediction method based on spatiotemporal multi-graph convolutional neural network (STMGCN). By extracting multiple inherent correlations in the maritime traffic network, the pairwise correlations between regions are encoded into multiple graphs, and then these correlations are explicitly modeled through multi-graph convolution, so as to accurately capture these complex spatiotemporal dependencies and further improve the accuracy of marine traffic flow prediction.
[0030] See also Figure 1 , is a flow chart of a method for predicting ship traffic flow in an embodiment of the present invention. The method comprises: Step S10, collecting historical ship traffic flow data provided by the Automatic Identification System AIS and performing pre-processing operations.
[0031] The preprocessing operation may include data cleaning and normalization.
[0032] Step S11, the historical ship traffic flow data is processed by time serialization and spatial dimension integration to construct a three-dimensional tensor of the ship traffic flow time series.
[0033] The ship traffic flow data includes time points, nodes, and feature dimensions.
[0034] Please also see Figure 2 Step S11, i.e., performing time serialization and spatial dimension integration processing on the historical ship traffic flow data to construct a three-dimensional tensor of the ship traffic flow time series, specifically comprises the following steps: Step S110, using the historical ship traffic flow data to construct a specific time point t Ship traffic flow matrix .
[0035] Specifically, at the time point t , collect all the ocean network N The traffic flow data of each node is combined into a traffic flow matrix , to indicate that at a specific point in time t The traffic flow status of each node in the marine transportation network. N Represents the number of nodes, each of which may represent a port, waterway intersection or other important maritime traffic location; C Represents the feature dimension. The data of each node may include but is not limited to flow size, direction, speed and other features. These features constitute the feature dimension C .
[0036] Step S111, by collecting the historical ship traffic flow data T time step N The traffic flow data of each node is used to construct a three-dimensional tensor .
[0037] When it is clear that at a specific point in time t The traffic flow status of each node in the marine transportation network is collected, and the historical ship traffic flow data is collected. T time step N The traffic flow data of each node is combined into a three-dimensional tensor , to indicate that in the total T In the marine transportation network of time segments, a total ofN Traffic flow status of each node.
[0038] Step S12, feature encoding is performed on the three-dimensional tensor of the ship traffic flow time series to extract features with characterization capabilities.
[0039] The features with representation capabilities are advanced features that can better represent key information and patterns in the original data. These features usually have the following characteristics: (1) Abstractness: Features no longer directly correspond to directly observable values in the original data, but are obtained through an abstraction process and can capture implicit patterns and structures in the data; (2) Information concentration: Through feature extraction, key information can be extracted from a large amount of raw data, redundancy can be removed, and the feature set can be made more compact; (3) Expressive power: These features can express data in a richer way. For example, they may contain information about the trend, periodicity, seasonality, etc. of the time series. (4) Predictive power: Features with representational capabilities are more useful for prediction tasks because they can better capture the key factors that affect future events; (5) Dimensionality reduction: In some cases, representational features may exist in a lower-dimensional space, which helps reduce the complexity of the model and improve computational efficiency; (6) Nonlinearity: Representational features may be obtained through nonlinear transformations, which enables the model to learn and simulate more complex data relationships.
[0040] Specifically, collect the traffic flow matrix at multiple time points in a continuous time series , the traffic flow matrices at these time points are stacked in chronological order to form the three-dimensional tensor, that is, , the dimension of this three-dimensional tensor is T × N × C , where the first dimension T Represents the length of the time series, the second dimension N Represents the number of nodes at each time point, the third dimension C Represents the characteristic dimension of each node. Each "layer" or "slice" of this three-dimensional data structure corresponds to a time point. t Traffic flow matrix .
[0041] In this way, the 3D tensor contains not only the state at a single point in time, but also dynamic information over time, such as patterns of traffic growth, decrease, fluctuation, etc. This information is crucial for understanding the time dependency of ship traffic and making effective forecasts.
[0042] In this embodiment, “feature encoding is performed on the three-dimensional tensor of the ship traffic flow time series to extract features with characterization capability”, specifically: a multi-layer perceptron (MLP) is applied to the three-dimensional tensor of the ship traffic flow time series. MLP ) is used for feature encoding, and the original traffic flow data is encoded and mapped to the hidden dimension to extract features with representation capabilities. Among them, the continuous time series traffic flow data (i.e., three-dimensional tensor) V ) as input, using MLP The model for each time point t The three-dimensional tensor Encode to obtain encoded feature data (i.e., feature data with representation capabilities) , as described in formula (1): (1) in, D The encoded feature data The hidden dimension of the original data can be different from the dimension of the original data. C ;latitude D Represents the number of features of the encoded data, which can capture more complex patterns and relationships in the original data. It is a continuous time series of ship traffic data V A specific time point extracted from t When you need to calculate the data matrix for a specific time step t When encoding data from ship traffic data V Extract the corresponding N × C The matrix, that is, .
[0043] Thus, the encoded feature data It will be used as the input of multiple subsequent stacked spatiotemporal multi-graph convolution modules for further analysis and prediction of ship traffic flow.
[0044] Step S13, extracting and fusing the temporal features and spatial features of the features with characterization capabilities to generate a prediction result of the ship traffic flow.
[0045] Please also see Figure 3 Step S13, i.e., extracting and fusing the temporal features and spatial features of the features with characterization capability to generate a prediction result of the ship traffic flow, specifically includes: Step S130, using the first time convolutional network The input sequence is organized into features with characterization capabilities Perform convolution operation to get the output , to extract dynamic features.
[0046] The features with characterization capabilities are organized into a three-dimensional input sequence ; l Represents a layer in a model, such as a temporal convolutional layer in a deep learning model. M Represents the second dimension in the sequence, usually representing the number of time steps. The length of this dimension M It indicates the time span of the observation or prediction, for example, it can be the number of hours or days in the past; N Represents the number of nodes at each time point; The first temporal convolution is a one-dimensional causal convolution; K represents the size of the convolution kernel, that is, the number of input time steps considered in the convolution operation. For example, if K = 3, the convolution operation will consider the features of the current time step and the two time steps before and after it at the same time; Represents the number of channels of the input data. In the temporal convolution layer, the features of each time step may be composed of multiple different features. It is the number of these features. For example, in ship traffic flow prediction, each time step may contain multiple features such as flow size, direction, speed, etc. Represents the number of channels of the output data, that is, the number of features output by the convolutional layer. This number is usually the same as the number of filters in the convolutional layer, and each filter produces an output channel. The size can be expressed as , which means that each filter will output two The channel features may be designed to capture different types of feature changes. For example, if = 64 and = 32, then each filter will extract information from 64 input features and generate 32 output features, and each time step will use K Such a filter.
[0047] Applying one-dimensional causal convolution on the time dimension enables the model to capture dynamic features in time series, such as increasing or decreasing trends in traffic, periodic patterns, etc. Causal convolution is applicable to time series data, which ensures that future information is not used when making predictions, thereby maintaining the causal nature of time series analysis.
[0048] Using the one-dimensional causal convolution Perform causal convolution on the time series of each traffic node and transform the input sequence Mapped to two outputs , thereby extracting the dynamic characteristics of the time series; among them, A and B The same number of channels.
[0049] Specifically, using convolution The input sequence Mapped to two outputs The process refers to the convolution operation in processing the input sequence When, through the convolution kernel right C in The input channels are processed and generated C out Channel output A and B This process can be understood as a feature extraction operation, where A and B represents two different feature representations extracted from the original data. In the temporal convolution layer, the convolution operation takes into account the input features. K adjacent time steps without padding, which results in the sequence length decreasing each time K -1. For the temporal convolution input of each node, it can be regarded as having C in The length of the channel is M sequence .convolution The input sequence Mapping , A and B have the same number of channels, and A and B Both part of.
[0050] Step S131, applying a nonlinear activation function to perform a first time gated convolution process on the extracted dynamic features, screening key features to obtain a key time series feature fusion matrix that fuses the key features.
[0051] Please also see Figure 4 , is a schematic diagram of a temporal convolution structure provided by an embodiment of the present invention. In this embodiment, the nonlinear activation function is a gated linear unit (GLU), and the definition of the first temporal gated convolution is as described in formula (2): (2) in, represents two independent inputs to the GLU, represents the Hadamard product, Represents the key time series feature fusion matrix.
[0052] Use GLU on the temporal convolution output A and B Perform nonlinear transformation through Sigmoid gating of GLU δ ( B ) Identify combinatorial structures and dynamic changes in time series and identify inputs to the current state A Which parts of are important features? Through the Hadamard product Important features to be identified A The final output is fused with the gated results, and the filtered features are integrated to construct the final time series output. , which are the feature representations obtained after the first time gated convolution and GLU processing, these features capture the time dependency and dynamic changes of the ship traffic flow data.
[0053] The gating mechanism in GLU is implemented through a Sigmoid layer, which generates a weight for each feature, with values between 0 and 1. Through the gating mechanism, the model can selectively weight the input data to highlight those features that are more useful for prediction. GLU multiplies the gated output with the original input data. This nonlinear transformation increases the expressive power of the model, enabling it to capture more complex time series patterns. In this way, GLU not only retains the useful information in the original data, but also enhances the model's ability to respond to this information. Finally, the output of GLU is the weighted input data, which is fed into the next layer of the model for further processing and prediction.
[0054] Step S132, obtaining a spatial fusion feature matrix by constructing and fusing features of multiple spatial correlation graphs.
[0055] Please also see Figure 5 Step S132, i.e., obtaining a spatial fusion feature matrix by constructing and fusing features of multiple spatial correlation graphs, specifically includes: Step S1320, constructing a plurality of spatial correlation graphs using the features between two adjacent nodes in the maritime traffic network graph.
[0056] Wherein, the spatial correlation graph includes a distance graph , Interaction diagram And dynamic attention map The specific construction principle is as follows.
[0057] (1) Constructing a distance map : Use the inverse of the distance between two adjacent nodes in the maritime traffic network graph to construct an adjacency matrix to extract the distance graph .
[0058] Specifically, using traffic nodes The distance between different nodes is calculated by the centroid geographic coordinates; Indicates a traffic node and The nautical mile distance between the centroids, the adjacency matrix Elements Representation Node and The inverse of the distance between , then, the distance map As described in formula (3): (3) Two adjacent nodes in the maritime traffic network graph may share similar navigation behaviors; the distance graph Describes the distance characteristics between traffic nodes. In particular, the reciprocal of the distance between nodes is used to represent the weight between two nodes to reflect the similarity or interaction frequency between nodes; therefore, the closer the nodes are, the higher the weight.
[0059] (2) Constructing an interaction diagram : Use the historical navigation records between two adjacent nodes in the maritime traffic network graph to construct an adjacency matrix to extract the interaction graph .
[0060] Specifically, Indicates a traffic node and The historical navigation records between Elements Directly from the historical navigation record composition, reflecting the interaction strength between nodes, that is, , then, the interaction diagram As described in formula (4): (4) In addition to distance, the historical traffic flow between traffic nodes is also an important feature of maritime traffic. For example, if the traffic node and There are many navigation records between them, then the two nodes tend to influence each other, and the traffic flow has a certain correlation. Used to indicate the interaction frequency or traffic correlation between two nodes based on historical navigation records.
[0061] (3) Constructing a dynamic attention map : Construct an adjacency matrix by calculating the attention score matrix of each time node in the maritime traffic network graph to extract the dynamic attention map .
[0062] Specifically, for the time node t , calculate an attention score matrix , where the elements Representation Node and This method allows the model to dynamically adjust the relationship between nodes according to the dynamic changes between time nodes. At each time node, a new attention score matrix can be calculated based on the current context information and historical data to capture the changes in time and the dynamic relationship between nodes. Therefore, the adjacency matrix , and get the dynamic attention map As described in formula (5): (5) The attention score matrix is a matrix that represents the relationship between nodes, where each element represents the importance or attention of a node to other nodes. The relationship between nodes in the maritime traffic network graph changes dynamically over time, so for each time node, the adjacency matrix is constructed by calculating the attention score matrix to further extract the dynamic attention map. .
[0063] Through dynamic attention map , which is used to capture the dynamic changes of the relationship between nodes and reflect the importance or attention level of nodes at a time node.
[0064] Step S1321, performing different spatial correlation graph convolution operations on the input sequence to obtain corresponding feature matrices; and concatenating the feature matrices of different spatial correlation graphs to form the spatial fusion feature matrix.
[0065] Specifically, a spatial graph convolution operation is performed on the input sequence through formula (6) to obtain a corresponding feature matrix; (6) in, Represents the input sequence, which has C in Channels and length M sequence , whose shape is N × M × C in . represents the feature matrix; W is the weight matrix, whose shape is C in × C out , used for graph convolution operations. Representing spatial correlation graph G The corresponding adjacency matrix, for each spatial correlation graph G (Including distance map , Interaction diagram and dynamic attention map ), whose shape is M × N × N . express ReLU Activation function.
[0066] Therefore, based on formula (6), we can know that when the input sequence Input three GCN modules, corresponding to the distance map of the maritime transportation network , Interaction diagram And dynamic attention map , generate three feature matrices, represented as , and By concatenating these feature matrices, a spatial fusion feature matrix is formed, as described in formula (7), and enters the next temporal convolution layer as input.
[0067] (7) in, Represents a matrix concatenation operation.
[0068] Step S133: Use a second temporal convolutional network to perform a convolution operation on the spatial fusion feature matrix again to extract dynamic features again.
[0069] Step S134, applying a nonlinear activation function to perform a second time-gated convolution process on the dynamic features extracted again, screening key features to obtain an enhanced time series prediction feature matrix integrating the key features.
[0070] The enhanced time series prediction feature matrix is the model's prediction of ship traffic flow based on current and historical information; the nonlinear activation function is the application of a gated linear unit (GLU), and the definition of the second time gated convolution is as described in formula (8): (8) represents two independent inputs of the nonlinear activation function, Represents the enhanced time series forecast feature matrix.
[0071] Specifically, use GLU to convolve the temporal output and Perform nonlinear transformation through Sigmoid gating of GLU Identify combinatorial structures and dynamic changes in time series and identify inputs to the current state Which parts of are important features? Through the Hadamard product Important features to be identified The final output is fused with the gated results, and the filtered features are integrated to construct the final time series output. , used for subsequent analysis or predictive modeling.
[0072] Step S135, transforming the enhanced time series prediction feature matrix to generate a ship traffic flow prediction result.
[0073] The prediction result is , indicating that in the total A total of N Prediction of traffic flow status at each node.
[0074] As mentioned above, each spatiotemporal multi-graph convolutional model block consists of two time-gated convolutional layers and one spatial multi-graph convolutional layer, which are run alternately to fully utilize the spatiotemporal features in the ship traffic flow data. The spatiotemporal multi-graph convolution model block finally calculates the predicted ship traffic flow value by applying the time gated convolution layer and the spatial multi-graph convolution layer and following the calculation process described in formulas (2), (6), (7), and (8). This process ensures that the model can capture the dynamic changes of time series and the heterogeneity of spatial distribution, thereby achieving accurate prediction of ship traffic flow.
[0075] Please also see Figure 6 , before step S234, that is, using the second time convolutional network Before performing a convolution operation on the spatial fusion feature matrix again to extract dynamic features again, the method further includes: Step S233, performing feature compression and fusion on the spatial fusion feature matrix through a bottleneck convolution layer to generate a compressed feature matrix.
[0076] In this embodiment, the bottleneck convolution layer is a 1×1 convolution layer.
[0077] Figure 6 The method flow of another embodiment of step S13 is shown in FIG. 1 . For other steps and descriptions, please refer to FIG. Figure 3 And the corresponding text description will not be repeated here.
[0078] In order to improve the generalization ability and computational efficiency of the model, a bottleneck structure is introduced between the temporal convolution layer and the graph convolution layer. The feature matrix is compressed and fused through 1×1 convolution operations to reduce the spatial dimension of the features, thereby reducing the number of parameters and computational complexity of the model. While compressing the features, the bottleneck structure is also responsible for fusing the features from different spatial graph convolution layers to ensure that the information of different features can be integrated together to provide a unified feature representation for the subsequent temporal convolution layer. The bottleneck structure can select features through its convolution operation, retain the most important information for the prediction task, and remove redundant or unimportant features. In this way, the bottleneck structure not only improves the performance of the model, but also enables the model to process high-dimensional spatiotemporal data more efficiently. In this way, STMGCN is able to capture the complex spatiotemporal features in ship traffic data and generate accurate prediction results.
[0079] As described above, the present invention provides a ship traffic flow prediction method based on a spatiotemporal multi-graph convolutional network (STMGCN), which constructs a distance graph, an interaction graph and a dynamic attention graph through the STMGCN model to describe the spatial correlation between nodes in the maritime traffic network, takes into account the inter-dependence and spatial heterogeneity of complex maritime traffic dynamics, and effectively captures the potential temporal and spatial correlation in the ship traffic flow; through this capture, the model can understand and predict the trend and pattern of flow changes, thereby improving the accuracy of the prediction results; and solves the complexity of maritime ship traffic flow prediction, especially for time series prediction problems with highly dynamic and nonlinear characteristics; through the ship traffic flow prediction method, it is of great significance to improve the efficiency of maritime traffic management, optimize route planning and enhance maritime traffic safety.
[0080] The present invention is not only applicable to the prediction of ship traffic flow in a specific sea area, but can also be replicated and expanded to other sea areas, showing good generalization ability.
[0081] Below, the historical ship traffic data of four years from 2019 to 2022 in the waters near Denmark are used as experimental objects to illustrate the ship traffic flow prediction method based on the spatiotemporal multi-graph convolutional network of the present invention, and the experimental results are verified.
[0082] In the STMGCN model, the hidden dimension of the initial encoded feature data is set to D =64. For a temporal convolution module, the input dimension of the first layer of temporal convolution is =64, the output dimension is =64; for the multi-image spatial graph convolution module, the input dimension =64, the output dimension is =32. Since there are three interaction graphs (distance graphs , Interaction diagram And dynamic attention map ), the dimension of the concatenated feature matrix is 3×32=96, so the input dimension of the second layer of temporal convolution is updated to =96, the output dimension is restored to =64.
[0083] The STMGCN model selects Adam as the optimizer, sets the initial learning rate to 0.001, performs 300 cycles of training, and adopts a learning rate decay and early stopping strategy, that is, after every 60 cycles, the learning rate will be reduced to 10% of the original; if the verification error converges within 30 consecutive steps, the training will be terminated early.
[0084] The ship traffic flow prediction method based on spatiotemporal multi-graph convolutional network of the present invention measures the performance of the model through three evaluation indicators to quantify the difference between the prediction and the actual observation; these three evaluation indicators are: mean absolute error (MAE), mean square root error (RMSE) and mean absolute percentage error (MAPE). These indicators are intended to quantify the difference between the model prediction and the actual observation. Among these indicators, the lower the value, the more accurate the model's prediction of the real data.
[0085] in, is the true value, is the predicted value, n is the total amount of data, where: (9) By using the above parameter settings and evaluation index calculation formula (9), we can obtain the ship traffic data for the waters near Denmark from 2019 to 2022 for four years. The prediction results of the test set are as follows: Fig.12 As shown, Fig.12 Shows different time steps The prediction performance under Fig.12 The experimental results show that the present invention solves the limitations of traditional methods in capturing the spatiotemporal characteristics of ship traffic flow by using the STMGCN model, especially when dealing with data with spatial heterogeneity and time dependence. The experimental results show that the STMGCN model can effectively capture the spatiotemporal characteristics of ship traffic flow at different time steps. The results show low MAE, RMSE and MAPE values, indicating that the model can accurately predict ship traffic flow. By introducing multi-graph convolutional layer and temporal convolutional layer, the model effectively integrates information from different spaces and times, improving the accuracy and reliability of prediction.
[0086] Experiments conducted on a dataset of waters near Denmark show that the model is not only effective in specific areas, but also may have good generalization capabilities and can adapt to the needs of ship traffic flow prediction in different sea areas.
[0087] Please also see Figure 7 , 8 , Figure 7 is a schematic diagram of the module structure of a ship traffic flow prediction device provided by an embodiment of the present invention, Figure 8 yes Figure 7 The schematic diagram of the architecture of an embodiment of the ship traffic flow prediction device in FIG. Corresponding to the above-mentioned ship traffic flow prediction method, an embodiment of the present invention provides a ship traffic flow prediction device 30, including: a data collection and processing unit 31, a traffic flow data organization unit 32, a feature extraction and encoding unit 33, a spatiotemporal multi-graph convolution unit 34, and an output layer transformation unit 35.
[0088] The data collection and processing unit 31 is used to collect historical ship traffic flow data provided by the ship automatic identification system AIS and perform preprocessing operations; wherein the preprocessing operations may include data cleaning and normalization.
[0089] The traffic flow data organizing unit 32 is used to perform time serialization and spatial dimension integration processing on the historical ship traffic flow data collected by the data collecting and processing unit 31 to construct a three-dimensional tensor of the ship traffic flow time series.
[0090] The ship traffic flow data includes time points, nodes, and feature dimensions.
[0091] Specifically, the traffic flow data organizing unit 32 uses the historical ship traffic flow data collected by the data collecting and processing unit 31 to construct a data flow chart representing a specific time point. t Ship traffic flow matrix ; and by collecting said historical vessel traffic data in T time step N The traffic flow data of each node is used to construct a three-dimensional tensor .in, N Represents the number of nodes, each of which may represent a port, waterway intersection or other important maritime traffic location; C Represents the feature dimension. The data of each node may include but is not limited to flow size, direction, speed and other features. These features constitute the feature dimension C When it is clear that at a specific point in time t The traffic flow status of each node in the marine transportation network is collected, and the historical ship traffic flow data is collected. T time step N The traffic flow data of each node is combined into a three-dimensional tensor , to indicate that in the total T In the marine transportation network of time segments, a total of NTraffic flow status of each node.
[0092] The feature extraction and encoding unit 33 is used to perform feature encoding on the three-dimensional tensor of the ship traffic flow time series constructed by the traffic flow data organization unit 32, and extract features with characterization capabilities.
[0093] Specifically, the feature extraction and encoding unit 33 collects the traffic flow matrix at multiple time points in a continuous time series. , the traffic flow matrices at these time points are stacked in chronological order to form the three-dimensional tensor, that is, , the dimension of this three-dimensional tensor is T × N × C , where the first dimension T Represents the length of the time series, the second dimension N Represents the number of nodes at each time point, the third dimension C Represents the characteristic dimension of each node. Each "layer" or "slice" of this three-dimensional data structure corresponds to a time point. t Traffic flow matrix .
[0094] In this way, the 3D tensor contains not only the state at a single point in time, but also dynamic information over time, such as patterns of traffic growth, decrease, fluctuation, etc. This information is crucial for understanding the time dependency of ship traffic and making effective forecasts.
[0095] In this embodiment, the feature extraction and encoding unit 33 applies a multi-layer perceptron (MLP) to the three-dimensional tensor. MLP ) to perform feature encoding, and map the original traffic flow data encoding to the hidden dimension to extract features with representation capabilities. Specifically, the feature extraction and encoding unit 33 applies a multi-layer perceptron ( MLP ) for each time point t The three-dimensional tensor Encode to obtain encoded feature data (i.e., feature data with representation capabilities) , as described in formula (1): (1) in, D The encoded feature data The hidden dimension of the original data can be different from the dimension of the original data. C ;latitude D Represents the number of features of the encoded data, which can capture more complex patterns and relationships in the original data. is a three-dimensional tensor from the ship traffic flow time seriesV A specific time point extracted from t When you need to t When encoding the data, the three-dimensional tensor of the ship traffic flow time series V Extract the corresponding N × C The matrix, that is, .
[0096] Thus, the encoded feature data It will be used as the input of multiple subsequent stacked spatiotemporal multi-graph convolution modules for further analysis and prediction of ship traffic flow.
[0097] The spatiotemporal multi-graph convolution unit 34 is used to extract and fuse the temporal features and spatial features of the features with characterization capability generated by the feature extraction and encoding unit 33 to generate a prediction result of the ship traffic flow.
[0098] Please also see Fig. 9 , 10 , Fig. 9 is a schematic diagram of the module structure of the spatiotemporal multi-graph convolution unit, Fig.10 Schematic diagram of the architecture of the spatiotemporal multi-graph convolution unit. The spatiotemporal multi-graph convolution unit 34 includes: a first time convolution module 340, a spatial multi-graph convolution module 341, and a second time convolution module 342.
[0099] The first time convolution module 340 is used to use a first time convolution network The input sequence is organized into features with characterization capability generated by the feature extraction and encoding unit 33 Perform convolution operation to get the output , to extract dynamic features.
[0100] in, A and B The number of channels is the same as that of the input sequence; the features with characterization capabilities are organized into a three-dimensional input sequence ; l Represents a layer in a model, such as a temporal convolutional layer in a deep learning model. M Represents the second dimension in the sequence, usually representing the number of time steps. The length of this dimension M It indicates the time span of the observation or prediction, for example, it can be the number of hours or days in the past; N Represents the number of nodes at each time point; The first temporal convolution is a one-dimensional causal convolution; K represents the size of the convolution kernel, that is, the number of input time steps considered in the convolution operation. For example, ifK = 3, the convolution operation will consider the features of the current time step and the two time steps before and after it at the same time; Represents the number of channels of the input data. In the temporal convolution layer, the features of each time step may be composed of multiple different features. It is the number of these features. For example, in ship traffic flow prediction, each time step may contain multiple features such as flow size, direction, speed, etc. Represents the number of channels of the output data, that is, the number of features output by the convolutional layer. This number is usually the same as the number of filters in the convolutional layer, and each filter produces an output channel. The size can be expressed as , which means that each filter will output two The channel features may be designed to capture different types of feature changes. For example, if = 64 and = 32, then each filter will extract information from 64 input features and generate 32 output features, and each time step will use K Such a filter.
[0101] The first time convolution module 340 uses the one-dimensional causal convolution to perform a causal convolution operation on the time series of each traffic node, mapping the input sequence into two outputs, thereby extracting the dynamic features of the time series; wherein, A and B The same number of channels.
[0102] Furthermore, the first time convolution module 340 is also used to apply a nonlinear activation function to perform a first time gated convolution process on the extracted dynamic features, and screen key features to obtain a key time series feature fusion matrix that integrates the key features.
[0103] Please refer again Figure 4 , which is a schematic diagram of the structure of the time gated convolution in an embodiment of the present invention. In this embodiment, the nonlinear activation function is a gated linear unit (GLU), and the definition of the first time gated convolution is as described in formula (2): (2) in, represents two independent inputs to the GLU, represents the Hadamard product, Represents the key time series feature fusion matrix.
[0104] The first temporal convolution module 340 uses GLU to convolve the temporal output A and BPerform nonlinear transformation through Sigmoid gating of GLU Identify combinatorial structures and dynamic changes in time series and identify inputs to the current state A Which parts of are important features? Through the Hadamard product Important features to be identified A The final output is fused with the gated results, and the filtered features are integrated to construct the final time series output. .
[0105] The spatial multi-graph convolution module 341 is used to obtain a spatial fusion feature matrix by constructing and fusing features of multiple spatial correlation graphs.
[0106] The spatial multi-graph convolution module 341 constructs multiple spatial correlation graphs using the features between two adjacent nodes in the marine traffic network graph, specifically including: (1) Constructing a distance map :The spatial multi-graph convolution module 341 uses the inverse of the distance between two adjacent nodes in the marine traffic network graph to construct an adjacency matrix to extract the distance graph .
[0107] Two adjacent nodes in the maritime traffic network graph may share similar navigation behaviors; the distance graph Describes the distance characteristics between traffic nodes. In particular, the reciprocal of the distance between nodes is used to represent the weight between two nodes to reflect the similarity or interaction frequency between nodes; therefore, the closer the nodes are, the higher the weight.
[0108] Using Traffic Nodes The distance between different nodes is calculated by the centroid geographic coordinates; Indicates a traffic node and The nautical mile distance between the centroids, the adjacency matrix Elements Representation Node and The inverse of the distance between , then, the distance map As described in formula (3): (3) (2) Constructing an interaction diagram :The spatial multi-graph convolution module 341 uses the historical navigation records between two adjacent nodes in the maritime traffic network graph to construct an adjacency matrix to extract the interaction graph .
[0109] In addition to distance, the historical traffic flow between traffic nodes is also an important feature of maritime traffic. For example, if the traffic node and There are many navigation records between them, then the two nodes tend to influence each other, and the traffic flow has a certain correlation. Used to indicate the interaction frequency or traffic correlation between two nodes based on historical navigation records.
[0110] set up Indicates a traffic node and The historical navigation records between Elements Directly from the historical navigation record composition, reflecting the interaction strength between nodes, that is, , then, the interaction diagram As described in formula (4): (4) (3) Constructing a dynamic attention map :The spatial multi-graph convolution module 341 constructs an adjacency matrix by calculating the attention score matrix of each time node of the marine traffic network graph to extract the dynamic attention graph .
[0111] Dynamic Attention Map , which is used to capture the dynamic changes of the relationship between nodes and reflect the importance or attention level of nodes at a time node.
[0112] The relationship between nodes in the maritime traffic network graph changes dynamically over time. Therefore, for each time node, the adjacency matrix is constructed by calculating the attention score matrix to further extract the dynamic attention graph. .
[0113] The attention score matrix is a matrix that represents the relationship between nodes, where each element represents the importance or attention of a node to other nodes. Specifically, for the time node t , calculate an attention score matrix , where the elements Representation Node and This method allows the model to dynamically adjust the relationship between nodes according to the dynamic changes between time nodes. At each time node, a new attention score matrix can be calculated based on the current context information and historical data to capture the changes in time and the dynamic relationship between nodes. Therefore, the adjacency matrix , and get the dynamic attention map As described in formula (5): (5) The spatial multi-graph convolution module 341 is further used to perform different spatial correlation graph convolution operations on the input sequence to obtain a corresponding feature matrix; and to concatenate the feature matrices of different spatial correlation graphs to form the spatial fusion feature matrix.
[0114] Specifically, the spatial multi-graph convolution module 341 performs a spatial graph convolution operation on the input sequence through formula (6): (6) in, Represents the input sequence, which has C in Channels and length M sequence , whose shape is N × M × C in . represents the feature matrix; W is the weight matrix, whose shape is C in × C out , used for graph convolution operations. Representing spatial correlation graph G The corresponding adjacency matrix, for each spatial correlation graph G (Including distance map , Interaction diagram and dynamic attention map ), whose shape is M × N × N . express ReLU Activation function.
[0115] Therefore, based on formula (6), we can know that when the input sequence Input three GCN modules, corresponding to the distance map of the maritime transportation network , Interaction diagram And dynamic attention map , generate three feature matrices, represented as , and By concatenating these feature matrices, a spatial fusion feature matrix is formed, as described in formula (7), and enters the next temporal convolution layer as input.
[0116] (7) in, Represents a matrix concatenation operation.
[0117] The second temporal convolution module 342 is used to receive the spatial fusion feature matrix input by the spatial multi-graph convolution module 341, and use a second temporal convolution network to perform a convolution operation on the spatial fusion feature matrix again to extract dynamic features again; and apply a nonlinear activation function to perform a second temporal gated convolution processing on the dynamic features extracted again, and screen key features to obtain an enhanced time series prediction feature matrix that integrates the key features.
[0118] The enhanced time series prediction feature matrix is the model's prediction of ship traffic flow based on current and historical information. The nonlinear activation function is the application of a gated linear unit (GLU), and the definition of the second time gated convolution is as described in formula (8): (8) represents two independent inputs of the nonlinear activation function, Represents the enhanced time series forecast feature matrix.
[0119] The second temporal convolution module 342 uses GLU to convolve the temporal output and Perform nonlinear transformation through Sigmoid gating of GLU Identify combinatorial structures and dynamic changes in time series and identify inputs to the current state Which parts of are important features? Through the Hadamard product Important features to be identified The final output is fused with the gated results, and the filtered features are integrated to construct the final time series output. , used for subsequent analysis or predictive modeling.
[0120] Through the above process, the model finally generates the predicted ship traffic flow ,These predictions can capture the future changes of the time series.,The model improves the generalization ability of unseen data by learning the ,temporal features of historical ship traffic flow data.
[0121] In summary, feature fusion and time convolution processing units are key steps in realizing ship traffic flow prediction. They improve the prediction accuracy and efficiency of the model by extracting and fusing spatiotemporal features, and ultimately obtain the ship traffic flow prediction results required by this application.
[0122] The output layer transformation unit 35 is used to transform the enhanced time series prediction feature matrix output by the second time convolution module 342 to output a prediction result.
[0123] The prediction result is , indicating that in the total A total of N Prediction of traffic flow status at each node.
[0124] In this embodiment, the spatiotemporal multi-graph convolution unit 34 also includes a feature compression module 343, which is used to compress and fuse the concatenated feature matrix through a 1×1 convolution layer to generate a compressed feature matrix, ready for the next step of temporal convolution processing.
[0125] The advantages and beneficial effects of a ship traffic flow prediction method have been explained above and will not be repeated here. Moreover, since a ship traffic flow prediction device is applied to a ship traffic flow prediction method, it satisfies the same advantages and beneficial effects as the ship traffic flow prediction method.
[0126] Please refer again Figure 8 The present invention provides a ship traffic flow prediction device 30, which may include a spatiotemporal multi-graph convolution unit 34, wherein the spatiotemporal multi-graph convolution unit 34 calculates the predicted ship traffic flow prediction value by applying two temporal convolution modules and one spatial multi-graph convolution module to run alternately. .
[0127] In other embodiments, when the ship traffic flow data is highly complex and diverse, and a single spatiotemporal multi-graph convolution unit 34 may not be sufficient to capture all relevant spatiotemporal features, the ship traffic flow prediction device 30 may also include multiple spatiotemporal multi-graph convolution units 34. By adding more spatiotemporal multi-graph convolution units 34, the device can process more feature representations in parallel, thereby improving the understanding of traffic flow patterns and enhancing the accuracy of predictions.
[0128] In some embodiments, when the model depth needs to be increased to learn deeper features, multiple spatiotemporal multi-graph convolution units 34 can be set to form a deep network structure. Different spatiotemporal multi-graph convolution units 34 can focus on feature extraction at different time scales or spatial scales to capture multi-scale traffic flow patterns from micro to macro.
[0129] When the ship traffic flow prediction device 30 includes multiple spatiotemporal multi-graph convolution units 34, the operation mode of the multiple spatiotemporal multi-graph convolution units 34 can be adjusted according to the operation needs of the model. For example, they can work simultaneously and independently process different parts or different features of the input data to improve the computing efficiency in a parallel manner; in a deep learning model, multiple spatiotemporal multi-graph convolution units 34 can be stacked to form a sequence, in which the output of each unit is used as the input of the next unit, so as to achieve deep feature extraction. After the multiple spatiotemporal multi-graph convolution units 34 have processed the data, a fusion mechanism can be designed to effectively integrate the output features of different units to form a comprehensive traffic flow feature representation.
[0130] Through this design, the ship traffic flow prediction device 30 can flexibly adapt to different prediction tasks and data characteristics, and achieve efficient and accurate ship traffic flow prediction.
[0131] One of the embodiments of the present invention further provides a readable storage medium, in which a computer program is stored. The computer program includes program instructions. When the program instructions are executed by a processor of an electronic device, the processor executes the steps of the ship traffic flow prediction method described in any of the above embodiments.
[0132] One of the embodiments of the present invention further provides an electronic device, comprising: a processor and a memory, the memory being used to store computer program code, the computer program code comprising computer instructions, and when the processor executes the computer instructions, the electronic device executes the steps of the ship traffic flow prediction method described in any of the above embodiments.
[0133] See also Fig.11 , is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention.
[0134] The electronic device 4 includes a processor 41, a memory 42, an input device 43, and an output device 44. The processor 41, the memory 42, the input device 43, and the output device 44 are coupled via a connector, and the connector includes various interfaces, transmission lines, or buses, etc., which are not limited in the embodiments of the present invention. It should be understood that in various embodiments of the present invention, coupling refers to mutual connection in a specific manner, including direct connection or indirect connection through other devices, for example, through various interfaces, transmission lines, buses, etc.
[0135] The processor 41 described in the embodiment of the present application can be implemented by hardware, firmware, software or a combination thereof, and can use a circuit, a single or multiple application-specific integrated circuits (Application Specific Integrated Circuit, ASIC), a digital signal processor (Digital Signal Processor, DSP), a digital signal processing device (Digital Signal Processing Device, DSPD), a programmable logic device (Programmable Logic Device, PLD), a field programmable gate array (Field Programmable Gate Array, FPGA), a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, at least one of a microprocessor, and also includes other physical, biological or chemical structures that can achieve similar or equivalent functions to the processors listed above, such as biological neurons, quantum computing units, DNA computing units, etc., so that the processor can execute some or all of the steps in the computer program or method involved in the various embodiments of the present application, or any combination of the steps mentioned therein. In the electronic device 4 of this embodiment, the processor 41 can be a single processor or a combination of two or more processors in terms of physical entity, such as a combination of a CPU and a GPU, a combination of a CPU and an FPGA, a combination of a CPU and an ASIC, a combination of a CPU and a coprocessor, and a combination of a CPU and a DSP, etc. In the embodiment, these combinations are collectively referred to as processors like a single processor.
[0136] The computer program 45 involved in the embodiment can be stored in a computer device readable storage medium, which includes but is not limited to a disk, a tape, a magnetic card, a floppy disk, a flash memory, an optical disk, an optical card, a read-only memory (ROM), a random access memory (RAM), an erasable programmable ROM (EPROM) and an electrically erasable programmable ROM (EEPROM), etc., and also includes other biological, physical or chemical structures that can achieve similar or equivalent functions to the storage media listed above, such as DNA, RNA, protein and other units with information storage capabilities. In a specific embodiment, the storage medium involved can be one of the above-mentioned media types, or a combination of the above-mentioned media types. In different embodiments, the computer program involved in the embodiment can be stored in a single medium in a centralized manner, or can be stored in multiple media in a distributed manner.
[0137] The memory 42 containing a computer device readable storage medium may be a non-volatile memory or a random access memory. These computer device readable storage media may be built into the device, or may be connected to the device involved in the embodiment as an external device or part of an external device. In some embodiments, the memory with a computer device readable storage medium is deployed locally; in other embodiments, a scheme of deploying the memory away from the processor may also be adopted, such as a network attached memory accessed via an RF circuit or an external port and a communication network, wherein the communication network may be the Internet, one or more intranets, a local area network (LAN), a wide area network (WLAN), a storage area network (SAN), etc., or a suitable combination thereof, as long as the computer device can access the memory. In addition, the computer program involved in the embodiment may be stored in plaintext / ciphertext form, or may be designed as training data, which may be integrated and reorganized by model training and implicitly stored in the parameter state of a deep neural network or other machine learning model.
[0138] like Fig.11 In the illustrated embodiment, the computer program 45 is stored in the memory 42 of the electronic device 4, but the reader should be aware that other solutions that can enable the processor to execute the computer program are feasible.
[0139] The input device 43 is used to input data and / or signals, and the output device 44 is used to output data and / or signals. The output device 44 and the input device 43 may be independent devices or an integrated device.
[0140] It can be understood that in the embodiment of the present invention, the memory 42 is not only used to store related instructions, and the embodiment of the present invention does not limit the specific data stored in the memory.
[0141] Understandably, Fig.11 Only a simplified design of an electronic device is shown. In practical applications, the electronic device may also include other necessary components, including but not limited to any number of input / output devices, processors, memories, etc., and all ship traffic flow prediction methods that can implement the embodiments of the present invention are within the protection scope of the present invention.
[0142] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical or other forms.
[0143] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0144] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0145] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the technical solution of the present invention can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a management server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: read-only memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.
[0146] Finally, it should be noted that although the above embodiments have been described in the specification and drawings of this application, this does not limit the scope of patent protection of this application. All technical solutions generated by replacing or modifying equivalent structures or equivalent processes based on the essential concept of this application using the contents recorded in the specification and drawings of this application, as well as directly or indirectly implementing the technical solutions of the above embodiments in other related technical fields, are included in the scope of patent protection of this application.
Claims
1. A method for predicting ship traffic flow, characterized in that: The method comprises: Collect historical ship traffic data provided by the Automatic Identification System (AIS); The historical ship traffic flow data is processed by time series and spatial dimension integration to construct a three-dimensional tensor of the ship traffic flow time series; Performing feature encoding on the three-dimensional tensor of the ship traffic flow time series to extract features with characterization capabilities; and The temporal and spatial features of the features with characterization capability are extracted and integrated to generate a prediction result of the ship traffic flow.
2. The ship traffic flow prediction method according to claim 1, characterized in that: Extracting and fusing the temporal and spatial features of the features with characterization capabilities to generate prediction results of ship traffic flow, specifically including: Using the first time convolutional network The input sequence is organized into features with characterization capabilities Perform convolution operation to get the output , to extract dynamic features; among them, l represents a temporal convolution layer, M represents the number of time steps, N Indicates the number of nodes at each time point; K represents the convolution kernel size of the temporal convolution, is the number of channels of input data, is the number of channels for output data; Applying a nonlinear activation function to perform a first time gated convolution process on the extracted dynamic features, screening key features to obtain a key time series feature fusion matrix integrating the key features; wherein the first time gated convolution is defined as in formula (2); represents two independent inputs to the nonlinear activation function, represents the Hadamard product, Represents the key time series feature fusion matrix; (2) By constructing and fusing the features of multiple spatial correlation graphs, a spatial fusion feature matrix is obtained; Using a second temporal convolutional network Performing a convolution operation on the spatial fusion feature matrix again to extract dynamic features again; Apply a nonlinear activation function to perform a second time gated convolution process on the dynamic features extracted again, screen the key features to obtain an enhanced time series prediction feature matrix integrating the key features; wherein the definition of the second time gated convolution is as described in formula (8); represents two independent inputs of the nonlinear activation function, represents the enhanced time series prediction feature matrix; (8) The enhanced time series prediction feature matrix is transformed to generate a ship traffic flow prediction result; wherein the prediction result is .
3. The ship traffic flow prediction method according to claim 2, characterized in that: By constructing and fusing the features of multiple spatial correlation graphs, a spatial fusion feature matrix is obtained, which specifically includes: Multiple spatial correlation graphs are constructed using the features between two adjacent nodes in the maritime traffic network graph; wherein the spatial correlation graphs include distance graphs , Interaction diagram And dynamic attention map ; Performing different spatial correlation graph convolution operations on the input sequence to obtain corresponding feature matrices; and concatenating the feature matrices of different spatial correlation graphs to form the spatial fusion feature matrix; (6) (7) in, represents the feature matrix, W Represents the weight matrix, whose shape is C in × C out ; Representing spatial correlation graph G The corresponding adjacency matrix has the shape of M × N × N ; express ReLU Activation function; represents the feature matrix concatenation operation, Represents the spatial fusion feature matrix.
4. The method for predicting ship traffic flow according to claim 3, characterized in that: Using the features between two adjacent nodes in the maritime traffic network graph, multiple spatial correlation graphs are constructed, including: The adjacency matrix is constructed using the inverse of the distance between two adjacent nodes in the maritime traffic network graph, and the distance graph is extracted using formula (3): ;in, Representation Node and The nautical mile distance between the centroids of is the adjacency matrix Elements of , representing nodes and The reciprocal of the distance between; (3) The adjacency matrix is constructed by using the historical navigation records between two adjacent nodes in the maritime traffic network graph, and the interaction graph is extracted using formula (4): ;in, ; Representation Node and Historical navigation records between is the adjacency matrix Elements, recorded by historical navigation constitute; (4) The adjacency matrix is constructed by calculating the attention score matrix of each time node in the maritime traffic network graph, and the dynamic attention graph is extracted by formula (5) ;in, ; is the attention score matrix Elements of , representing nodes and Attention score; (5)。 5. A vessel traffic flow prediction device, characterized in that: The device comprises: A data collection and processing unit for collecting historical ship traffic flow data provided by the ship automatic identification system AIS; A traffic flow data organizing unit, used for performing time series and spatial dimension integration processing on the historical ship traffic flow data to construct a three-dimensional tensor of the ship traffic flow time series; A feature extraction and encoding unit, used for performing feature encoding on the three-dimensional tensor of the ship traffic flow time series, and extracting features with characterization capabilities; A spatiotemporal multi-graph convolution unit, used to extract and fuse the temporal features and spatial features of the features with representation capabilities to generate a fused feature matrix; and The output layer transformation unit is used to transform the fused feature matrix output by the spatiotemporal multi-graph convolution unit to generate and output the prediction result of the ship traffic flow.
6. The vessel traffic flow prediction device according to claim 5, characterized in that: The spatiotemporal multi-graph convolution unit comprises: The first temporal convolution module is used to: Using the first time convolutional network The input sequence is organized into features with characterization capabilities Perform convolution operation to get the output , to extract dynamic features; among them, l represents a temporal convolution layer, M represents the number of time steps, N Indicates the number of nodes at each time point; K represents the convolution kernel size of the temporal convolution, is the number of channels of input data, is the number of channels for output data; and Applying a nonlinear activation function to perform a first time gated convolution process on the extracted dynamic features, screening key features to obtain a key time series feature fusion matrix integrating the key features; wherein the first time gated convolution is defined as in formula (2); represents two independent inputs to the nonlinear activation function, represents the Hadamard product, Represents the key time series feature fusion matrix; (2) The spatial multi-graph convolution module is used to obtain a spatial fusion feature matrix by constructing and fusing the features of multiple spatial correlation graphs; The second temporal convolution module is used to: Using a second temporal convolutional network performing a convolution operation on the spatial fusion feature matrix again to extract dynamic features again; and Apply a nonlinear activation function to perform a second time gated convolution process on the dynamic features extracted again, screen the key features to obtain an enhanced time series prediction feature matrix integrating the key features; wherein the definition of the second time gated convolution is as described in formula (8); represents two independent inputs of the nonlinear activation function, represents the enhanced time series prediction feature matrix; (8) The output layer transformation unit is further used to transform the enhanced time series prediction feature matrix to generate a ship traffic flow prediction result; wherein the prediction result is .
7. The vessel traffic flow prediction device according to claim 6, characterized in that: The spatial multi-graph convolution module is further used for: Multiple spatial correlation graphs are constructed using the features between two adjacent nodes in the maritime traffic network graph; wherein the spatial correlation graphs include distance graphs , Interaction diagram And dynamic attention map ; Performing different spatial correlation graph convolution operations on the input sequence to obtain corresponding feature matrices; and concatenating the feature matrices of different spatial correlation graphs to form the spatial fusion feature matrix; (6) (7) in, represents the feature matrix, W Represents the weight matrix, whose shape is C in × C out ; Representing spatial correlation graph G The corresponding adjacency matrix has the shape of M × N × N ; express ReLU Activation function; represents the feature matrix concatenation operation, Represents the spatial fusion feature matrix.
8. The vessel traffic flow prediction device according to claim 7, characterized in that: The spatial multi-graph convolution module is further used for: The adjacency matrix is constructed using the inverse of the distance between two adjacent nodes in the maritime traffic network graph, and the distance graph is extracted using formula (3): ;in, Representation Node and The nautical mile distance between the centroids of is the adjacency matrix Elements of , representing nodes and The reciprocal of the distance between; (3) The adjacency matrix is constructed by using the historical navigation records between two adjacent nodes in the maritime traffic network graph, and the interaction graph is extracted using formula (4): ;in, ; Representation Node and Historical navigation records between is the adjacency matrix Elements of It consists of historical navigation records; (4) The adjacency matrix is constructed by calculating the attention score matrix of each time node in the maritime traffic network graph, and the dynamic attention graph is extracted by formula (5) ;in, ; is the attention score matrix Elements of , representing nodes and Attention score; (5)。 9. An electronic device, comprising: A processor and a memory, characterized in that the memory is used to store computer program codes, the computer program codes include computer instructions, and when the processor executes the computer instructions, the electronic device executes the steps of the ship traffic flow prediction method as described in any one of claims 1 to 4.
10. A readable storage medium having a computer program stored therein, characterized in that: The computer program includes program instructions, and when the program instructions are executed by a processor of an electronic device, the processor executes the steps of the ship traffic flow prediction method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Traffic prediction method, intelligent terminal and computer readable storage medium
CN112766551A
Ship trajectory multi-modal prediction method and system
CN117520874A
Cited By
Maritime traffic network mining method
CN121255792A
A maritime traffic network mining method
CN121255792B
Deep learning-based ship travel service prediction method and system
CN122088991A