A multi-factor-related method for predicting ship flow in port waters

By constructing a weighted ship behavior diagram and multi-dimensional correlation analysis model, combining geographical information and AIS data, the problem of insufficient forecasting of ship traffic flow under multi-factor coupling conditions in the existing technology is solved, and higher prediction accuracy and reliability are achieved adapts to complex port environments.

CN118800099BActive Publication Date: 2024-12-24WUHAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411270197.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-11
Publication Date
2024-12-24
Estimated Expiration
2044-09-11

AI Technical Summary

Technical Problem

The existing ship traffic flow prediction methods are difficult to consider multi-factor coupling conditions, resulting in insufficient prediction accuracy and reliability in complex scenarios, and it is especially difficult to adapt to rapidly changing environmental conditions and emergencies.

Method used

Using a multi-factor-related ship flow prediction method, a weighted ship behavior map is constructed by obtaining historical ship navigation trajectories, combining geographical information data and ship automatic identification system (AIS) data, identifying ship habitual routes and regional behaviors, and building multi-dimensional Correlation analysis model, using graph theory and time series prediction technology to make predictions.

Benefits of technology

It significantly improves the accuracy and reliability of ship traffic flow forecasts, can adapt to complex port environments, reflect the mutual influence between regions, and can respond to environmental changes in real time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118800099B_ABST
    Figure CN118800099B_ABST
Patent Text Reader

Abstract

The invention discloses a method for predicting the ship flow in port waters with multi-factor association, comprising the following steps: dividing historical ship navigation tracks into a plurality of groups by a clustering algorithm to obtain customary ship routes in port waters; setting the intersection of the customary ship routes and the boundaries of the functional area and non-functional area of ​​the port waters as the first node, setting the port area and anchorage of the port waters as the second node, setting the customary ship routes as the edges, setting the weights of the nodes and the edges according to the flow characteristics of the nodes and the edges, and constructing a weighted ship behavior graph of the port waters; selecting nodes or edges in the weighted ship behavior graph as prediction targets, obtaining the weights of the target nodes and their associated nodes or the target edges and their associated edges as the input of the prediction model, and obtaining the predicted value of the ship flow of the prediction target; identifying abnormal nodes in the weighted ship behavior graph based on navigation rules and customary navigation methods, updating the input of the prediction model, and optimizing the prediction model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of intelligent management of shipping traffic, and in particular relates to a method for predicting ship flow in port waters with multiple associated factors. Background Art

[0002] As a key node in the shipping network, the effective management and prediction of ship traffic at ports has a significant impact on ensuring shipping safety, improving port operation efficiency, reducing logistics costs, and protecting the environment. However, the prediction of ship traffic has always been a complex and challenging task, mainly because there are many and interrelated factors that affect the traffic, including but not limited to ship behavior patterns, weather changes, tidal cycles, port operation arrangements, etc.

[0003] Traditional ship traffic flow forecasting methods mainly rely on statistical models and empirical rules. These methods perform well when dealing with simple linear relationships, but their forecasting accuracy is often limited when faced with complex nonlinear problems and long-term dependencies. In addition, these methods are usually difficult to adapt to rapidly changing environmental conditions and emergencies, resulting in insufficient reliability and real-time performance of the forecast results.

[0004] Therefore, there is an urgent need for a ship flow prediction method that takes multiple factors into consideration to improve the accuracy and reliability of the prediction. Summary of the invention

[0005] The present invention proposes a method for predicting ship flow in port waters with multiple factors associated, which solves the problem that the existing prediction methods do not consider the ship flow prediction under the conditions of multiple factor coupling and cannot meet the prediction needs in complex scenarios.

[0006] In order to solve the above technical problems, the present invention provides a method for predicting the ship flow in port waters with multi-factor association, comprising the following steps:

[0007] Step S1: obtaining historical ship navigation tracks in the port waters, and using a clustering algorithm to divide the historical ship navigation tracks into a number of groups to obtain customary ship routes in the port waters;

[0008] Step S2: identifying the functional area and non-functional area of ​​the port waters according to the geographic information data of the port waters, setting the intersection of the ship's customary route and the boundary of the functional area and the non-functional area as the first node, setting the port area and anchorage of the port waters as the second node, setting the ship's customary route as the edge, and constructing a ship behavior graph of the port waters;

[0009] Step S3: extracting the flow characteristics of the nodes and edges in the ship behavior graph, setting the weights of the nodes and edges according to the flow characteristics, and constructing a weighted ship behavior graph of the port waters;

[0010] Step S4: selecting a node or edge in the weighted ship behavior graph as a prediction target. If a node is selected as a target node, obtaining an associated node of the target node, and using the weights of the target node and the associated node as inputs of a prediction model to obtain a predicted value of ship flow of the prediction target.

[0011] If an edge is selected as a target edge, the associated edge of the target edge is obtained, and the weights of the target edge and the associated edge are used as inputs of a prediction model to obtain a predicted value of ship flow of the predicted target.

[0012] Preferably, in step S1, the dynamic time warping distance DTW between the two historical ship navigation trajectories is calculated as the trajectory similarity, and the historical ship navigation trajectories are clustered using a clustering algorithm. The expression of the dynamic time warping distance DTW is:

[0013]

[0014] Where DTW(T1,T2) is the dynamic time warping distance between the historical ship navigation trajectories T1 and T2; P1 i and P2 j is the position of the historical ship navigation track T1 and T2 at time i and time j; d(P1 i ,P2 j ) is P1 i and P2 j The Euclidean distance between 1i ,y 1i )、(x 2j ,y 2j ) are P1 i and P2 j coordinates; minDTW(T 1{i -1 } ,T 2{j-1} ) represents the minimum value of the dynamic time-warped distance between the position points of the historical ship navigation trajectories T1 and T2 at time i-1 and time j-1.

[0015] Preferably, the functional area in step S2 includes a vessel traffic service VTS reporting line, a port area, an anchorage, a waterway and a coastline, and the non-functional area is an area other than the functional area in the port area. In step S2, the shape feature points of the coastline are identified by a light bar method, and the shape feature points of the coastline are connected to obtain the coastline, which includes the following steps:

[0016] Step S21: Let the set of points on the coastline be {p i}, i∈{1, 2, …, n}, the aperture of the light barrier is d;

[0017] Step S22: connect p1 and p2, draw a straight line through p2 that is perpendicular to the line segment p1p2, take two auxiliary points a1 and a2 on the perpendicular line, make the line segment a1p2=a2p2=d / 2, take p1 as the vertex, and the lines connecting p1 and a1, and p1 and a2 as the two sides of the fan, forming a fan-shaped area;

[0018] Step S23: Determine whether p3 is within the fan-shaped area. If so, connect p1 and p3, draw a perpendicular line through p3 to the line segment p1p3, set the perpendicular line to intersect the edge of the fan-shaped area at c1 and c2, find two new auxiliary points b1 and b2 on the perpendicular line, and make the line segment p3b1=p3b2=d / 2;

[0019] If b1 falls outside the sector area, c1 is used to replace b1 as the auxiliary point; if b2 falls outside the sector area, c2 is used to replace b2 as the auxiliary point, and the line connecting p1 and the auxiliary point is used as the two sides of the new sector;

[0020] Step S24: repeat step S23 until there is a point p outside the latest obtained sector area;

[0021] Step S25: The above steps are repeated until all points on the coastline are judged to obtain the shape feature points of the coastline.

[0022] Preferably, the step S3 of constructing a weighted ship behavior diagram of the port waters comprises the following steps:

[0023] Step S31: Acquire the AIS data of all ships in the port waters within a set time period, obtain the navigation status of the ship according to the AIS data of the ship, match the AIS data of the ship with the geographic information data of the port, and obtain the navigation status of the ship in various areas of the port waters;

[0024] Step S32: defining the behavior of the ship in each area of ​​the port waters according to the navigation status of the ship in each area of ​​the port waters and the navigation rules of each area;

[0025] Step S33: Calculate the number of ships entering and leaving each node within the set time period as the weight of the node according to the behavior of the ships in each area, and calculate the number of ships sailing and the average sailing time of each edge within the set time period as the weight of the edge.

[0026] Preferably, the matching of the ship's AIS data with the port's geographic information data in step S31 includes the following steps: obtaining the ship's trajectory point through the ship's AIS data, obtaining a set of neighboring areas of the trajectory point p, the neighboring areas including polygonal areas and circular areas, if the vector cross product of the trajectory point p and the polygonal area is greater than 0, then the trajectory point p belongs to the polygonal area; if the distance between the trajectory point p and the center of the circular area is less than the radius of the circular area, then the trajectory point p belongs to the circular area, repeating the above steps to obtain the areas to which all trajectory points belong.

[0027] Preferably, the expression for calculating the vector cross product of the trajectory point and the polygonal area is:

[0028] D=d1·d2·...·d i ...·d n ;

[0029] d i =(y i -y)·(x i+1 -x)-(y i+1 -y)·(x i -x);

[0030] Where D is the vector cross product of the trajectory point and the polygon area; (x, y) is the coordinate of the trajectory point; (x i ,y i ) is the coordinate of vertex i of the polygonal area, and the polygonal area includes a plurality of vertices; d i is the vector cross product between the trajectory point and the vertex i of the polygonal region.

[0031] Preferably, in step S4, the associated nodes are nodes adjacent to the target node, and the associated edges are edges adjacent to the target edge, and a set of associated nodes or associated edges is obtained, and m-dimensional data is selected from the set as input of the prediction model.

[0032] Preferably, the input expression of the prediction model is:

[0033]

[0034] Where X is the input of the prediction model; X1(t n ) is t n The weight of the target prediction at each moment; X2(t n ),X m (t n ) is t n The node or edge X2, X2 is associated with each other at any time. m The weight of t1~t n For different moments.

[0035] Preferably, in step S4, nodes and edges with abnormal weights in the weighted ship behavior graph are identified according to the navigation rules of the port waters, and multiple groups of prediction model inputs are obtained by changing the proportion of abnormal weights in the input of the prediction model.

[0036] Preferably, in step S4, the customary navigation of the port waters is set according to the historical ship navigation trajectory, abnormal trajectory points in the historical ship navigation trajectory are identified according to the customary navigation, the abnormal trajectory points are added to the set of associated nodes, and the input of the prediction model is updated.

[0037] The benefits of the present invention include at least:

[0038] 1. By combining the ship behavior trajectory in the port waters with geographic information data, the present invention not only identifies the ship's habitual routes, but also comprehensively considers the key nodes such as the port area and anchorage and the traffic characteristics of the route, and realizes the multi-dimensional correlation analysis of the ship behavior in the port waters. This fine-grained behavior graph construction method can deeply explore the internal connection and regularity of ship behavior, and provide rich data support for the prediction model;

[0039] 2. The present invention utilizes the weighted ship behavior graph and constructs a multi-factor correlation prediction model by associating the flow characteristics of nodes and edges, which significantly improves the accuracy of ship traffic flow prediction. This prediction based on multi-factor correlation not only reflects the mutual influence between various areas within the port, but also can adapt to the complex port environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 A schematic diagram of a method flow chart of an embodiment of the present invention;

[0041] Figure 2 A schematic diagram of the light barrier method used in an embodiment of the present invention;

[0042] Figure 3 The figure is a flowchart of selecting an associated node according to an embodiment of the present invention. DETAILED DESCRIPTION

[0043] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the protection scope of the present invention.

[0044] like Figure 1 As shown, an embodiment of the present invention provides a method for predicting ship flow in port waters with multi-factor association, comprising the following steps:

[0045] Step S1: Collect the AIS data of the ship and the geographic information data of the port waters, pre-process the collected data, and convert the navigation rules of the port waters from text information to data information.

[0046] Specifically, based on the AIS data of all ships in a certain time period in a port water area, the libais library in Python is selected to decode its important fields, such as the ship's marine mobile service identification code MMSI, longitude and latitude, time, speed, heading, call sign, ship name, size, destination and estimated arrival time ETA, etc. The decoded data is parsed into a format that is easy to understand and use, such as JSON, CSV format, etc. The decoded AIS data is traversed and checked, and abnormal data points with a speed greater than 50kn, longitude not between [-180°, 180°], and latitude not between [-90°, 90°] are deleted, and then the cubic spline difference method is used for interpolation to restore the AIS ship information of the unsampled interval points.

[0047] Port geographic information includes the latitude and longitude coordinates of the boundary points of the vessel traffic service VTS reporting line, anchorage, channel, port area, coastline, etc. Based on the latitude and longitude coordinates of the boundary points of the port area, anchorage, channel, etc., the geometric features of these elements, such as the expression of points, lines, and surfaces, can be realized, and the mathematical expression of the port ship behavior mapping vector base map can be realized.

[0048] The coastline is connected by control points, i.e., shape feature points, and the description method of geometric line segmentation is adopted to express its irregular curve characteristics. The closed area formed by the coastline and the VTS reporting line can determine the scope of the port waters. Because the coastline is irregularly curved, the light barrier method is adopted in the embodiment of the present invention to realize the extraction of the main shape feature points of the coastline, such as Figure 2 As shown, the following steps are included:

[0049] S1: Let the set of points on the coastline be {p i}, i∈{1, 2,…, n}, and the aperture of the light barrier is d.

[0050] S2: Connect P i and P i+1 Point, pass P i+1 Draw a line perpendicular to line segment P i P i+1 On the perpendicular line, take two points a1 and a2 so that the line segment a1P i+1 =a2P i+1 =d / 2, with P i is the vertex, P i With a1, P i The lines connecting a2 are the two sides of the sector, forming a sector-shaped area.

[0051] S3: Determine P i+2 Is the point inside the sector? If so, connect P i and P i+2 , over P i+2 Draw line segment P i P i+2 The perpendicular line of S2 intersects the edge of the sector defined in S2 at c1 and c2. Find points b1 and b2 on the perpendicular line so that the line segment P i+2 b1=P i+2 b2=d / 2.

[0052] If point b1 or b2 falls outside the original sector area, replace point b1 or b2 with c1 or c2, for example, replace b2 with c2. i b1 and P i The lines connecting c2 serve as the two sides of the new fan.

[0053] S4: Let i = i + 1, repeat S3 until a node is found outside the newly defined fan. When a node outside the fan is found, such as Figure 2 If point P4 is missing, point P3 will be retained.

[0054] S5: The above steps are repeated until the last point of the coastline, and the extraction of the main shape feature points of the coastline is completed.

[0055] In addition, for waters that are not divided into functional areas and are available for ship navigation, the mathematical and geometric representation of their geographic information is also achieved by connecting control points to construct polygons. Areas that are not divided into functional areas are areas within the port except for VTS reporting lines, anchorages, waterways, and port areas. The control points are the vertices of the polygonal area, which can be obtained in the geographic information data of the port waters. If the area is a rectangle, four shape boundaries are used to express it. When encountering an area with a complex shape, the area can be split into multiple rectangles or triangles for expression.

[0056] By defining a class containing name, point set, radius and control point, the names and ranges of different anchorages, channels and ports can be defined as follows:

[0057] Anchorage: Anchorage{Anchorage_name,Point_List}

[0058] Fairway: Fairway{Fairway_name,Point_List}

[0059] Harbour: Harbour{Harbour_name,Point_List}

[0060] Coastline: Costline{Costline_name,Point_List}

[0061] When the VTS reporting line is a circle, it is expressed by the following formula:

[0062] VTS report line: VTS{rCircle,(xcen,ycen)}

[0063] When the VTS report line is in other shapes, it is expressed by the following formula:

[0064] VTS reporting line: VTS{Point_List)}

[0065] Undivided navigation area: Navigable_Area{Navigable_Area_name,Point_List}

[0066] Among them, Anchorage_name is the name of the anchorage; Fairway_name is the name of the fairway; Harbour_name is the name of the port area; Costline_name is the name of the coastline; Navigable_Area_name is the name of the undivided navigable waters; rCircle is the radius of the circular VTS reporting line; (xcen, ycen) are the coordinates of the center control point of the circular VTS reporting line; Point_List is the latitude and longitude matrix of the control point.

[0067] The navigation rules for ships in port waters are usually presented in text form. When judging whether the ship's behavior is compliant, these rules need to be compared with geographic information and AIS data, so these text-based information needs to be converted into data-based information. The main operation is to extract relevant information about the corresponding port ship navigation rules and perform data processing. For example, the maximum speed west of the No. 35 light buoy in the main channel shall not exceed 13kn, which can be converted to: if lon<117.915°E, S≤13kn, where lon is the longitude of the ship's position point and S is the speed. If the ship's speed is greater than 13kn, that is, if lon<117.915°E, S>13kn, the ship's behavior is abnormal.

[0068] Step S2: Constructing a ship behavior map in the port waters, including the following steps:

[0069] Step S21: Visualization of AIS tracks.

[0070] Specifically, based on the preprocessed AIS data, the historical location information of the ship is extracted, including timestamp, longitude and latitude coordinates. The extracted location information is smoothed to eliminate noise and outliers. Appropriate visualization tools such as D3.js, Plotly, Highcharts, etc., and map libraries such as Leaflet, OpenLayers, Mapbox GL JS, etc. are selected to map the extracted location information onto a two-dimensional map to generate the ship's navigation track, which is convenient for subsequent clustering of various track groups.

[0071] The expression of the first-order difference smoothing formula for smoothing is:

[0072]

[0073] Among them, P(t) is the original position data at time t; is the smoothed position data at time t.

[0074] Step S22: using the dynamic time warping distance DTW to calculate the similarity between the two trajectories, and using the K-means clustering algorithm to divide the trajectories into different groups according to the calculated similarity.

[0075] Specifically, suppose there are two trajectories T1 and T2, each of which consists of a series of position points T1=(P1 1 , P1 2 , ...P1i, ...,P1m) and T2=(P2 1 , P2 2 ,...P2j,...,P2n), where P1 i and P2 j are the positions of trajectories T1 and T2 at time i and time j respectively, which can be represented as P1 in two dimensions. i =(x 1i ,y 1i ), P2 j =(x 2j ,y 2j ). (x 1i ,y 1i )、(x 2j ,y 2j ) represent the horizontal and vertical coordinates of the longitude and latitude coordinates in the AIS track after Mercator transverse projection.

[0076] The goal of the DTW algorithm is to find a path with the minimum total distance from T1 to T2. Each step on the path connects a point in T1 to a point in T2 and meets the following conditions: 1) The path starts from every point in T1 and ends at the last point in T2; 2) The path cannot have a return, that is, each step is forward.

[0077] The recursive formula for calculating D(T1, T2) using DTW distance is as follows:

[0078]

[0079] Where DTW(T1,T2) is the dynamic time warping distance between trajectories T1 and T2; P1i and P2 j is the position of trajectory T1 and T2 at time i and time j; d(P1 i ,P2 j ) is P1 i and P2 j The Euclidean distance between 1i ,y 1i ), (x2j, y2j) are P1 respectively i and P2 j coordinates; minDTW(T 1{i -1 } ,T 2{j-1} ) represents the minimum value of the dynamic time warping distance between the position points of trajectories T1 and T2 at time i-1 and time j-1.

[0080] After using the clustering algorithm to divide the trajectories into different groups, the habitual navigation routes of ships between the navigable waters of the channel-anchorage-berth-other undefined functional areas in the port waters can be obtained, providing a basis for the subsequent construction of the ship behavior map in the port waters.

[0081] Step S23: Determine the nodes and edges of the ship behavior graph.

[0082] Specifically, in order to distinguish port geographic information elements such as port areas, anchorages and waterways, the positions of ships entering the waterway, leaving the waterway, entering undefined functional waters, leaving undefined functional waters, entering the VTS reporting line, and leaving the VTS reporting line in the ship's customary route can be set as virtual nodes, i.e., the first node, and the ship's customary route obtained above is set as a virtual edge. At the same time, according to the pre-processed geographic information, functional areas such as port areas and anchorages are set as second nodes, and waterways are set as edges. In this way, all nodes and edges contained in a complete port water area are defined to obtain a ship behavior graph.

[0083] Step S24: Ship position and behavior identification.

[0084] Specifically, based on the matching results of the ship's latitude and longitude extracted from the AIS data with the waterway, anchorage, berth, undefined functional waters, coastline, and VTS reports of the port waters, the ship's behavior in various areas is judged, such as normal navigation in the waterway, anchorage in the waterway, anchorage at the anchorage, berthing at the berth, navigation in other navigation areas, and anchoring in other navigation areas.

[0085] For the polygonal VTS reporting line, according to the names and ranges of different anchorages, channels, port areas, etc. defined in the aforementioned port geographic information, the vector cross product method is used to determine whether the ship behavior occurs in this area. Assuming that the longitude and latitude of the ship's track point is (x, y), the longitude and latitude control point matrix of the polygonal area is Point_List = {(x1, y1), ..., (x i ,y i ),...,(x n ,y n )}, calculate the vector cross product D between the trajectory point and the longitude and latitude control point matrix. If D>0, the ship behavior occurs in this area. The calculation expression of the vector cross product is:

[0086] D=d1·d2·...·d i ...·d n ;

[0087] d i =(y i -y)·(x i+1 -x)-(y i+1 -y)·(x i -x);

[0088] Where D is the vector cross product of the trajectory point and the polygonal area; (x, y) is the coordinate of the trajectory point; (xi, yi) is the coordinate of the vertex i of the polygonal area; d i is the vector cross product between the trajectory point and the vertex i of the polygonal region.

[0089] For a circular VTS reporting line, calculate the distance between the trajectory point (x, y) and the center of the circular VTS reporting line (xcen, ycen), and compare it with the radius r of the circular VTS reporting line. Circle For comparison, if the following inequality is satisfied, the ship behavior occurs in this area:

[0090]

[0091] According to the navigation rules of the port waters, the speed threshold and speed duration threshold corresponding to each water area are set. Combined with the navigation status of the ship and the area where the ship behavior occurs, the navigation or mooring status of the ship in the channel, anchorage, berth, and undefined functional waters is judged. The corresponding speed thresholds are: anchorage ship speed threshold, port area ship speed threshold, channel ship speed threshold, and port navigation area water area ship speed threshold. The corresponding speed duration thresholds are: anchorage anchoring time threshold, port area berthing time threshold, channel ship berthing time threshold, and port navigation area water area ship berthing time threshold. The setting of specific thresholds can be comprehensively considered according to the characteristics of the channel, anchorage, berth, etc. For example, berthing at berths and anchorages are bounded by anchor chains, while ships do not stay in the channel. Combined with the influence of hydrodynamics, the speed threshold set for ships staying at berths and anchorages can be smaller than the threshold for staying in the channel. The above-mentioned thresholds can be used to define the behavior of ships in different areas.

[0092] Based on the above analysis results, the behavior pattern of ships can be obtained, including the linkage mode of port approach waters-channel-anchorage-berth, etc.

[0093] Step S25: setting the weights of nodes and edges in the ship behavior graph according to the position and behavior of the ship.

[0094] Specifically, based on the behavior recognition results of the ship, and further combined with the time information, heading information, and speed information in the ship's AIS trajectory, the ship's sailing time, waiting time, sailing speed, heading, speed change, heading change and other characteristics in the port waterway, anchorage, berth, undefined functional waters and other areas can be obtained. The speed can be directly obtained through the ground speed SOG field in the AIS data. SOG indicates the forward speed of the ship relative to the ground. The heading can be obtained through the ground course COG field in the AIS data. COG is the angle of the ship's forward direction, usually with true north as the reference direction.

[0095] Count the number of ships entering each node and virtual node on a daily basis. a and the number of exits n l As the node weight Weight(v), the number of ships entering n a and the number of exits n l The unit is ship / day. The behavior of entering the channel through a virtual node outside the channel is defined as the entry behavior of the virtual node, and the behavior of leaving the channel through a virtual node within the channel is defined as the departure behavior of the virtual node. The node weights are as follows:

[0096]

[0097] Count the number of ships sailing on each side in days m and the flight time tm As the edge weight Weight(e), the number of sailing ships n m The unit is ship / day, and the sailing time is t m The unit is hour / ship. When the tracks of entry and exit are distributed over two days, it will result in the inability to form a complete edge. In this case, the method of completing and counting twice is adopted, that is, the tracks of two days are combined into a complete track and included in the weight of the two days. The edge weight is as follows:

[0098]

[0099] In the formula, It is the cumulative value of the time required for navigation, in hours.

[0100] It should be noted that the weights of each node and edge can also be defined as the longest waiting time of a ship, the shortest waiting time of a ship, the average waiting time of a ship, the maximum sailing speed, the minimum sailing speed, the average sailing speed, the minimum heading change value, the maximum heading change value, the average heading change value, the maximum speed change value, the minimum speed change value, the average speed change value, etc.

[0101] Step S26: construct a weighted directed behavior graph of ships in the port waters.

[0102] According to the set nodes and edges of the port waters and their weights, the weighted ship entry behavior graph and the weighted ship exit behavior graph of the port waters can be constructed. If the number of ships at a node is zero, it means that no ship passed through this node on that day; if the number of ships sailing at an edge is zero, it means that no ship used this route to enter or leave the port on that day. When visualizing, zero-weighted edges and zero-weighted nodes will be hidden. In addition, the color depth and diameter of each node are set to be positively correlated with the sum of the number of ships entering and leaving, and the color depth and width of each edge are positively correlated with the average sailing time and the number of ships sailing, respectively.

[0103] Based on the aforementioned ship behavior graphs in different areas at different times, and the weight analysis of each node and edge, a weighted directed behavior graph of ships under the linkage mode of port approach waters-channel-anchorage-berth can be obtained.

[0104] Step S3: Identification of abnormal behavior of ships in port waters.

[0105] Since in port waters, the impact of reduced speed and abnormal berthing of ships on navigation efficiency is most obvious, the present invention uses the following two methods to identify abnormal behaviors of ships and set variable parameters for the input of the subsequent traffic flow prediction model.

[0106] 1. Identification of abnormal ship behavior based on navigation rules

[0107] The abnormal behavior identification of ships based on navigation rules is mainly aimed at the abnormal speed of ships in the waterway. First, the AIS trajectory of the ship is matched with the geographic information data, the ship trajectory points in the waters covered by the navigation rules are screened, the ship's trajectory timestamp is recorded, and the speed of each trajectory point is judged based on the navigation rules to realize the abnormal speed behavior identification of ships based on navigation rules.

[0108] 2. Identification of abnormal ship behavior based on customary navigation methods

[0109] In order to avoid too frequent encounters caused by complex navigation methods, some navigation methods that are not explicitly stipulated but commonly accepted have been formed by comprehensively considering the meteorological and geographical characteristics of the navigation waters, as well as the good seamanship and navigation experience of the pilots. This is called customary navigation. Ships that do not adopt customary navigation to enter and leave the port may affect the port's operating efficiency and even bring about the risk of collision. Therefore, it is defined as abnormal behavior.

[0110] Considering that there are no clear route and navigation regulations in the undivided navigation area, and the navigable waters are generally sufficient in resources, the impact of abnormal speed on the normal navigation of ships in the navigation area is relatively small, while abnormal anchoring in the navigation area will occupy a large amount of navigation waters and have a greater impact on navigation safety. Therefore, the identification of abnormal ship behavior considering customary navigation mainly considers abnormal anchoring behavior.

[0111] Firstly, the historical track data of AIS of ships in the navigation area are screened, the track timestamps are recorded, and the track points with anchoring characteristics such as long-term low speed and no obvious changes in track points for a long time are captured. Then, they are associated with undefined navigation areas and waterways for analysis, so as to realize the identification of abnormal anchoring behavior in the navigation area.

[0112] Based on the above two methods, a vector diagram of abnormal ship behavior can be obtained, where the vector diagram of abnormal ship behavior can be an anomaly in the graph structure or a weight anomaly under a normal graph structure. For example, the above-mentioned speed anomaly is a weight anomaly in the graph structure, and long-term abnormal berthing points are usually added to the ship behavior graph structure as virtual nodes to distinguish anchorages and berths, thereby making the structure of the ship behavior graph abnormal.

[0113] Step S4: Construct a GT-LSTM prediction model and use the GT-LSTM prediction model to predict the ship flow in port waters, including the following steps:

[0114] Step S41: Construct a GT-LSTM prediction model.

[0115] The present invention combines graph theory to mine the correlation factors of the prediction target, and constructs a GT-LSTM model through the time series characteristics of different targets. The model can make full use of the topological structure of the traffic network and the information of time series data to improve the accuracy and robustness of traffic flow prediction.

[0116] Step S411: Define the network structure: Use a deep learning library such as Keras to build a long short-term memory network LSTM, create a sequential model, and then add an LSTM layer to process time series data.

[0117] First, define the model:

[0118] model = Sequential().

[0119] Add the first LSTM layer, returning a sequence for use by the next LSTM layer:

[0120] model.add(LSTM(units=units, return_sequences=True, input_shape=(n_timesteps,n_features))).

[0121] Add a second LSTM layer that does not return a sequence because this is the last LSTM layer:

[0122] model.add(LSTM(units=units,return_sequences=False)).

[0123] Add a fully connected layer with an output dimension equal to the number of features n_features:

[0124] model.add(Dense(n_features)).

[0125] Here, the units parameter is the number of neurons in the LSTM layer, n_timesteps is the time step of the input sequence, and n_features is the number of features of the input data.

[0126] Step S412: Compile the model: After completing the definition of the network structure, specify the optimizer, loss function and evaluation index.

[0127] model.compile(optimizer='adam',loss='mean_squared_error',metrics=['mae'])

[0128] Wherein, optimizer is the optimizer, loss is the loss function, and metrics is the evaluation index. In the embodiment of the present invention, the Adam optimizer is used, the loss function uses the mean square error MSE, and the evaluation index selects the mean absolute error MAE.

[0129] Step S42: Construct an input set for the GT-LSTM prediction model.

[0130] Step S421: Construct a time series dataset of the prediction target.

[0131] Select a node or an edge in the ship weighted directed behavior graph as the prediction target, and construct the time series dataset X of the prediction target according to its corresponding weight in the ship weighted directed behavior graph, as shown below:

[0132]

[0133] Among them, X1(t1) is the traffic flow characteristics of the predicted target at time t1, which can be the number of ships, ship speed, ship stay time, etc.; t1~t n For different moments.

[0134] Step S422: construct an association set of prediction targets.

[0135] According to the ship weighted directed behavior graph, the associated nodes or associated edges of the prediction target are obtained. The associated nodes or associated edges can be judged by the adjacency matrix of the nodes or edges in the ship weighted directed behavior graph, that is, the nodes or edges connected to the prediction target, and then the associated nodes with zero node connection weight in the associated node set or the associated edges with zero edge weight in the associated edge set are removed, and the rest are taken as the association set. Figure 3 The following is a selection process using the associated node as an example. v,v' is the line between node v and node v', weight(e v,v' ) is the weight of the link between node v and node v'.

[0136] Step S423: construct an input data set of the model according to the weights of the prediction target and its associated nodes or associated edges.

[0137] The traffic flow data of the prediction target and its associated set are sorted, that is, the weights in the weighted directed behavior graph of ships, and an m-dimensional associated data set containing the traffic flow data of the prediction target and its associated set is constructed as the input of the prediction model, as shown in the following formula:

[0138]

[0139] Among them, X is the input of the prediction model; X1(t n ) is t n The weight of the target prediction at each moment; X2(t n ),X m (t n ) is t n The node or edge X2, X2 is associated with each other at any time. m The weight of t1~t nFor different moments.

[0140] Since the input of the GT-LSTM model is a multidimensional data set, it is necessary to normalize the data of each dimension. The embodiment of the present invention uses the L2 norm normalization method to normalize the input set. The formula is as follows:

[0141]

[0142] in, is the normalized first-dimensional input vector; X1 is the original first-dimensional input vector, i.e., the first dimension in the m-dimensional associated data set; X1(t i ) is the original first-dimensional input vector t i The element at the moment; n is the number of elements in the first dimension of the original input vector. The other dimensions are calculated in the same way.

[0143] The embodiment of the present invention selects the annual ship traffic flow data of a certain port water area in a certain year to construct a data set, and obtains 2a groups of data, corresponding to a nodes in the ship behavior graph. Each node contains 2 groups of ship traffic flow data for entering and leaving the port. Each group of data sets contains 365 elements, corresponding to 365 days in a year, determined according to the actual number of days in that year. Considering aspects such as data trend analysis and accuracy evaluation, the embodiment of the present invention uses the data of the 1st to 335th elements of each node as a training set, and the data of the 336th to 365th elements as a test set.

[0144] Step S43: Train the GT-LSTM model using the constructed training set.

[0145] Use the training set to train the model and set parameters such as batch size, number of iterations, and validation set ratio:

[0146] history=model.fit(X_train, y_train, batch_size=batch_size, epochs=epochs, validation_split=0.2)

[0147] Among them, X_train is the training set, y_train is the corresponding target data set, batch_size is the batch size, that is, the number of samples passed to the model for training each time, epochs is the number of iterations, that is, the number of times the training data set is fully traversed, and validation_split is used to divide a part of the training data as a validation set to monitor performance changes during training.

[0148] Step S44: Evaluate model performance and tune the model.

[0149] Use the trained model to predict the test set and calculate the evaluation index of the prediction result. The embodiment of the present invention uses the mean absolute error MAE as the evaluation index. The smaller the MAE value, the better the model prediction performance. The calculation formula of MAE is as follows:

[0150]

[0151] in, is the traffic flow predicted by the model; y i is the actual traffic flow; N is the number of data points in the test set.

[0152] Based on the performance of the model on the test set, the parameters of the network structure or the hyperparameters of the training process can be adjusted according to the prediction requirements to further improve the performance of the model.

[0153] Specifically, based on the recognition results of abnormal ship behavior, a ship abnormal behavior graph with normal graph structure but abnormal weight can be obtained. From this graph, the ratio of the elements with abnormal weights in each column of the model input matrix to the total number of elements can be obtained. By linearly changing the ratio of ship data with abnormal behavior in each column, the input of multiple GT-LSTM models can be obtained, thereby obtaining different prediction results and improving prediction accuracy.

[0154] According to the recognition results of abnormal ship behavior, a graph of abnormal ship behavior with abnormal graph structure can be obtained. By adding abnormal behavior points to the virtual nodes of the predicted targets in the graph, a traffic flow data set of multiple predicted targets and their associated sets can be constructed, and then normalized and input into the model for training.

[0155] The improved prediction method can accurately predict the traffic flow in the port waters and help the port authorities understand the impact of abnormal events in their waters on the traffic flow in the waters, thereby helping the port authorities to better control abnormal events.

[0156] The present invention combines graph theory, ship behavior analysis, and time series prediction, and proposes a fine-grained port waters ship behavior graph construction and multi-factor association prediction model. By integrating AIS data, geographic information, and navigation rules, the port waters are abstracted into a network graph, in which nodes and edges represent different areas and waterways of the port, thereby achieving in-depth identification and analysis of ship behavior. Based on the normal behavior modeling and abnormal behavior analysis of ships at each node and edge, a fine-grained traffic flow prediction method based on ship behavior modeling is further proposed, which not only predicts the number of ships arriving at the port, but also can be further combined with the ship arrival time to predict the ship's sailing time in the waterway, waiting time at the anchorage, stay time at the berth, sailing time in undefined functional waters, waiting time in undefined waters, ship sailing speed in the waterway, ship sailing speed in undefined functional waters, ship heading in the waterway, etc. at different time scales.

[0157] The present invention uses the geographical distribution characteristics of the port to establish a ship behavior graph, and further combines the characteristics of the ship's sailing time, waiting time, sailing speed, heading, speed change, heading change, etc. in the port's internal waterways, anchorages, berths, and undefined functional waters to achieve ship movement behavior modeling inside the port. Based on the ship's mobile behavior characteristics, the ship's habitual behavior pattern is analyzed, including the linkage mode of port entry waters-channels-anchorages-berths, etc., so as to obtain the ship behavior in different areas and at different times. The weights of the nodes and edges in the ship behavior graph can be set according to the ship behavior. Then, the abnormal behavior pattern of the ship is further analyzed in combination with the port's navigation rules, the ship's habitual behavior pattern, etc., including not sailing according to regulations, not sailing according to habits, etc., so as to construct a ship abnormal behavior graph, which can be an abnormality in the graph structure, or an abnormality in the weight characteristics under the normal graph structure, etc. Then, based on the constructed normal and abnormal behavior graphs of ships, combined with the latest machine learning methods, the traffic flow in different waterways, different berths, different anchorages, and different undefined functional waters is predicted, including the number of ships in these areas, the speed of ships, the length of time ships stay, etc., so as to achieve fine-grained traffic flow prediction in port waters. While achieving traffic flow prediction in port waters, it helps port managers better control abnormal behavior of ships, providing a novel and effective technical support for shipping decision-making and port management.

[0158] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. Only the preferred embodiments of the present invention are expressed. The description is more specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. As long as there is no contradiction in the combination of these technical features, they should be considered as the scope recorded in this specification.

[0159] It should be noted that, for those skilled in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these modifications and improvements all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A method for predicting ship flow in port waters with multi-factor association, characterized in that: The following steps are involved: Step S1: obtaining historical ship navigation tracks in the port waters, and using a clustering algorithm to divide the historical ship navigation tracks into a number of groups to obtain customary ship routes in the port waters; Step S2: identifying the functional area and non-functional area of ​​the port waters according to the geographic information data of the port waters, setting the intersection of the ship's customary route and the boundary of the functional area and the non-functional area as the first node, setting the port area and anchorage of the port waters as the second node, setting the ship's customary route as the edge, and constructing a ship behavior graph of the port waters; The functional area includes the Vessel Traffic Service (VTS) reporting line, port area, anchorage, channel and coastline, and the non-functional area refers to the area in the port area except the functional area; Step S3: On a daily basis, the number of ships entering and leaving each node is counted as the node weight, and the number of ships sailing and the sailing time on each edge are counted as the edge weight, so as to construct a weighted ship behavior graph of the port waters; Step S4: selecting a node or edge in the weighted ship behavior graph as a prediction target. If a node is selected as a target node, obtaining an associated node of the target node, and using the weights of the target node and the associated node as inputs of a prediction model to obtain a predicted value of ship flow of the prediction target. If an edge is selected as a target edge, the associated edge of the target edge is obtained, and the weights of the target edge and the associated edge are used as inputs of the prediction model to obtain the predicted value of the ship flow of the prediction target; The associated node is a node adjacent to the target node, and the associated edge is an edge adjacent to the target edge.

2. The method for predicting ship flow in port waters with multiple factors associated according to claim 1 is characterized by: In step S1, the dynamic time warping distance DTW between the two historical ship navigation trajectories is calculated as the trajectory similarity, and the historical ship navigation trajectories are clustered using a clustering algorithm. The expression of the dynamic time warping distance DTW is: Where DTW(T1,T2) is the dynamic time warping distance between the historical ship navigation trajectories T1 and T2; P1 i and are the positions of the historical ship navigation trajectories T1 and T2 at time i and time j; For P1 i and The Euclidean distance between 1i ,y 1i )、(x 2j ,y 2j ) are P1 i and coordinates; minDTW(T 1{i-1} ,T 2{j-1} ) represents the minimum value of the dynamic time-warped distance between the position points of the historical ship navigation trajectories T1 and T2 at time i-1 and time j-1.

3. The method for predicting ship flow in port waters with multiple factors associated according to claim 1 is characterized by: In step S2, the shape feature points of the coastline are identified by the light barrier method, and the shape feature points of the coastline are connected to obtain the coastline, which includes the following steps: Step S21: Let the set of points on the coastline be {p i }, i∈{1, 2, …, n}, the aperture of the light barrier is d; Step S22: Connect p i and p i+1 , over p i+1 Draw a line perpendicular to line segment p i p i+1 straight line, take two auxiliary points a1 and a2 on the perpendicular line, so that the line segment a1p i+1 =a2p i+1 =d / 2, with p i is the vertex, p i With a1, p i The lines connecting a2 are the two sides of the fan, forming a fan-shaped area; Step S23: Determine p i+2 Is it in the fan-shaped area? If so, connect p i and p i+2 , over p i+2 Draw line segment p i p i+2 The perpendicular line intersects the edge of the sector at c1 and c2, and two new auxiliary points b1 and b2 are found on the perpendicular line, so that the line segment p i+2 b1=p i+2 b2=d / 2; If b1 falls outside the fan-shaped area, c1 is used to replace b1 as an auxiliary point. If b2 falls outside the fan-shaped area, c2 is used to replace b2 as an auxiliary point. i The lines connecting the auxiliary points serve as the two sides of the new sector; Step S24: let i=i+1, and repeat step S23 until there is a point p outside the newly obtained sector area; Step S25: The above steps are repeated until all points on the coastline are judged to obtain the shape feature points of the coastline.

4. The method for predicting ship flow in port waters with multiple factors associated according to claim 1 is characterized by: The step S3 of constructing the weighted ship behavior graph of the port waters includes the following steps: Step S31: Acquire the AIS data of all ships in the port waters within a set time period, obtain the navigation status of the ship according to the AIS data of the ship, match the AIS data of the ship with the geographic information data of the port, and obtain the navigation status of the ship in various areas of the port waters; Step S32: defining the behavior of the ship in each area of ​​the port waters according to the navigation status of the ship in each area of ​​the port waters and the navigation rules of each area; Step S33: Calculate the number of ships entering and leaving each node within the set time period as the weight of the node according to the behavior of the ships in each area, and calculate the number of ships sailing and the average sailing time of each edge within the set time period as the weight of the edge.

5. The method for predicting the ship flow in port waters with multiple factors associated according to claim 4 is characterized by: The matching of the ship's AIS data with the port's geographic information data in step S31 includes the following steps: obtaining the ship's trajectory point through the ship's AIS data, obtaining a set of neighboring areas of the trajectory point p, the neighboring areas including polygonal areas and circular areas, if the vector cross product of the trajectory point p and the polygonal area is greater than 0, then the trajectory point p belongs to the polygonal area; if the distance between the trajectory point p and the center of the circular area is less than the radius of the circular area, then the trajectory point p belongs to the circular area, repeating the above steps to obtain the areas to which all trajectory points belong.

6. The method for predicting ship flow in port waters with multiple factors associated according to claim 5 is characterized by: The expression for calculating the vector cross product of the trajectory point and the polygon area is: D=d1·d2·...·d i ...·d n ; d i (and i -y)·(x i+1 -x)-(y i+1 -y)·(x i -x); Where D is the vector cross product of the trajectory point and the polygon area; (x, y) is the coordinate of the trajectory point; (x i ,y i ) is the coordinate of vertex i of the polygonal area, and the polygonal area includes a plurality of vertices; d i is the vector cross product between the trajectory point and the vertex i of the polygonal region.

7. The method for predicting ship flow in port waters with multiple factors associated according to claim 1 is characterized by: In step S4, a set of associated nodes or associated edges is obtained, and m-dimensional data is selected from the set as input of the prediction model.

8. The method for predicting the ship flow in port waters with multiple factors associated according to claim 7 is characterized by: The input expression of the prediction model is: Where X is the input of the prediction model; X1(t n ) is t n The weight of the target prediction at each moment; X2(t n ),X m (t n ) is t n The node or edge X2, X2 is associated with each other at any time. m The weight of t1~t n For different moments.

9. The method for predicting the ship flow in port waters with multiple factors associated according to claim 7 is characterized by: In step S4, nodes and edges with abnormal weights in the weighted ship behavior graph are identified according to the navigation rules of the port waters, and multiple groups of prediction model inputs are obtained to optimize the prediction model by changing the proportion of abnormal weights in the input of the prediction model.

10. The method for predicting the ship flow in port waters with multiple factors associated according to claim 7, characterized in that: In step S4, the customary navigation of the port waters is set according to the historical ship navigation trajectory, the abnormal trajectory points in the historical ship navigation trajectory are identified according to the customary navigation, the abnormal trajectory points are added to the set of associated nodes, and the input of the prediction model is updated.