Ship berthing area identification method and device, electronic equipment and storage medium
By preprocessing and clustering the AIS data, and combining the semisine formula to calculate the waypoint distance, the problem of being unable to identify ship berthing areas in traditional shipping is solved, efficient and accurate berthing area identification is achieved, and operational efficiency is improved.
Patent Information
- Application Number
- CN202410628266.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-21
- Publication Date
- 2024-08-30
AI Technical Summary
In traditional shipping operations, the dense distribution and abnormal aggregation behavior of ship locations cannot be effectively identified, resulting in limited berthing and operational efficiency of ships at docks and anchorages.
An identification method based on AIS data is adopted, by obtaining the AIS data set of the area to be identified for preprocessing, using the specified DBSCAN algorithm for clustering processing, and combining the semisine vector formula to calculate the distance between waypoints and determine the ship berthing area.
It achieves accurate identification of ship berthing areas, improves operational efficiency, and ensures the accuracy and effectiveness of clustering results.
Smart Images

Figure CN118568530A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of navigation data processing, and in particular to a method and device for identifying a ship berthing area, an electronic device, and a computer-readable storage medium. Background Art
[0002] With the increasing development and expansion of international trade, shipping plays an increasingly important role and is called one of the most important means of transportation in international trade. In traditional shipping operations, it is impossible to effectively identify the dense distribution and abnormal aggregation of ship locations, resulting in limited efficiency in the berthing and operation of ships at docks and anchorages. In view of this, there is an urgent need for a solution to effectively identify ship berthing areas. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a method and device for identifying a ship's berthing area, an electronic device, and a storage medium, which are used to efficiently and accurately identify a ship's berthing area based on AIS data.
[0004] On the one hand, the present application provides a method for identifying a ship berthing area, comprising:
[0005] Acquire an AIS data set within a period of time to be identified in the area to be identified, and pre-process the AIS data set to obtain a waypoint set; wherein the waypoint set includes a plurality of waypoints, each waypoint including a waypoint longitude, a waypoint latitude, and a waypoint time;
[0006] Based on the specified DBSCAN algorithm, multiple waypoints in the waypoint set are clustered on the basis of a preset density threshold and a target area radius to obtain a plurality of clusters; wherein the distance algorithm in the specified DBSCAN algorithm is a haversine formula;
[0007] According to the plurality of clusters, a parking area corresponding to each cluster is determined.
[0008] In one embodiment, the preprocessing of the AIS data set to obtain a waypoint set includes:
[0009] Performing attribute selection on each piece of AIS data in the AIS data set to obtain a plurality of selected AIS data; wherein each piece of selected AIS data includes a ship identification code, a waypoint longitude, a waypoint latitude, and a waypoint time;
[0010] Filtering out selected AIS data located on land from multiple selected AIS data;
[0011] Determine and remove the selected AIS data corresponding to the same ship identification code in the filtering result, and perform deduplication processing to obtain deduplication AIS data; wherein the deduplication processing is to merge at least a specified number of continuous selected AIS data with the same position information into one AIS data;
[0012] Determine whether the number of waypoints indicated by the AIS data after deduplication of each ship identification code reaches the waypoint number threshold. If so, add the waypoint corresponding to the ship identification code to the waypoint set.
[0013] In one embodiment, the method for obtaining the waypoint quantity threshold includes:
[0014] Calculate the mean and standard deviation of the number of waypoints corresponding to all ship identification codes;
[0015] The waypoint quantity threshold is determined according to the average, a preset adjustment coefficient and the standard deviation.
[0016] In one embodiment, the step of obtaining the target area radius includes:
[0017] Calculate the distance between every two waypoints in the waypoint set based on the haversine formula to obtain multiple distances;
[0018] The multiple distances are sorted, and the nth distance is selected from the sorted multiple distances in ascending order as the target area radius; wherein n is calculated by the total number m of the multiple distances and a preset weight coefficient k.
[0019] In one embodiment, the specified DBSCSN algorithm performs clustering processing on multiple waypoints in the waypoint set based on a preset density threshold and a target area radius to obtain a plurality of clusters, including:
[0020] Based on the spatial dimension slicing rule and the temporal dimension slicing rule, the waypoint set is sliced to obtain a plurality of subsets; wherein each subset includes a plurality of waypoints;
[0021] For each subset, based on the specified DBSCSN algorithm, multiple waypoints in the subset are clustered on the basis of the preset density threshold and the target area radius to obtain several clusters corresponding to the subset;
[0022] The step of determining a parking area corresponding to each cluster according to the plurality of clusters includes:
[0023] Constructing a number of clusters corresponding to each subset into a cluster set;
[0024] Determine whether there is overlap between any two clusters in the cluster set;
[0025] If any two clusters overlap, the overlapping clusters are merged to obtain a merged cluster, and the merged cluster is added to the cluster set;
[0026] Returning to the step of determining whether any two clusters in the cluster set overlap, until no overlapping clusters exist in the cluster set;
[0027] A parking area corresponding to each cluster in the set of clusters is determined.
[0028] In one embodiment, the time dimension sharding rule indicates a time span corresponding to a single subset;
[0029] Before the waypoint set is fragmented based on the spatial dimension fragmentation rule and the time dimension fragmentation rule to obtain a plurality of subsets, the method further includes:
[0030] Determine the total number of waypoints for a single data shard based on the upper limit of available memory and the maximum memory consumption of a single data shard;
[0031] According to the total number of waypoints of a single data slice and the total number of waypoints of the waypoint set, a time span corresponding to a single subset is determined.
[0032] In one embodiment, determining a parking area corresponding to each cluster according to the plurality of clusters includes:
[0033] For each cluster, a convex hull is generated for the cluster, and a parking area corresponding to the cluster is determined based on a boundary position of the convex hull to obtain a parking area corresponding to each cluster.
[0034] On the other hand, the present application provides a device for identifying a ship berthing area, comprising:
[0035] A preprocessing module is used to obtain an AIS data set within a period of time to be identified in the area to be identified, and preprocess the AIS data set to obtain a waypoint set; wherein the waypoint set includes multiple waypoints, each waypoint includes a waypoint longitude, a waypoint latitude and a waypoint time;
[0036] A clustering module, for clustering a plurality of waypoints in the waypoint set based on a preset density threshold and a target area radius based on a specified DBSCAN algorithm to obtain a plurality of clusters; wherein the distance algorithm in the specified DBSCAN algorithm is a haversine formula;
[0037] The determination module is used to determine a parking area corresponding to each cluster according to the plurality of clusters.
[0038] Furthermore, the present application provides an electronic device, the electronic device comprising:
[0039] processor;
[0040] a memory for storing processor-executable instructions;
[0041] Wherein, the processor is configured to execute the above-mentioned method for identifying the ship berthing area.
[0042] In addition, the present application provides a computer-readable storage medium, which stores a computer program. The computer program can be executed by a processor to complete the above-mentioned method for identifying a ship berthing area.
[0043] The present application scheme clusters the AIS data of the area to be identified during the period to be identified, and can effectively identify the berthing area of the ship. Moreover, by setting a specified DBSCAN algorithm including a haversine formula, the distance between different ships can be accurately calculated during the clustering process, thereby obtaining an accurate clustering result and a correspondingly accurate berthing area. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solution of the embodiments of the present application, the drawings required for use in the embodiments of the present application are briefly introduced below.
[0045] Figure 1 A schematic diagram of an application scenario of a method for identifying a ship berthing area provided in an embodiment of the present application;
[0046] Figure 2 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application;
[0047] Figure 3 A schematic diagram of a flow chart of a method for identifying a ship berthing area provided in an embodiment of the present application;
[0048] Figure 4 A schematic diagram of a waypoint clustering effect provided by an embodiment of the present application;
[0049] Figure 5 A schematic diagram of the AIS data preprocessing process provided by an embodiment of the present application;
[0050] Figure 6 A schematic diagram of a flow chart of a method for determining a radius of a target area provided in an embodiment of the present application;
[0051] Figure 7 A schematic diagram of a flow chart of a method for determining a parking area provided in an embodiment of the present application;
[0052] Figure 8 A block diagram of a device for identifying a ship berthing area provided in one embodiment of the present application. DETAILED DESCRIPTION
[0053] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0054] Similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0055] Figure 1 Schematic diagram of an application scenario of the method for identifying a ship berthing area provided in an embodiment of the present application. Figure 1 As shown, the application scenario includes a client 20 and a server 30; the client 20 can be a server that provides AIS (Automatic Identification System) data, used to send AIS data to the server 30; the server 30 can be a server, a server cluster or a cloud computing center, which can perform the task of identifying the ship berthing area based on the acquired AIS data.
[0056] like Figure 2 As shown, this embodiment provides an electronic device 1, including: at least one processor 11 and a memory 12, Figure 2 A processor 11 is taken as an example. The processor 11 and the memory 12 are connected via a bus 10. The memory 12 stores instructions that can be executed by the processor 11. The instructions are executed by the processor 11 so that the electronic device 1 can execute all or part of the process of the method in the following embodiment. In one embodiment, the electronic device 1 can be the above-mentioned server 30, which is used to execute the method for identifying the ship berthing area.
[0057] The memory 12 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, disk or optical disk.
[0058] The present application also provides a computer-readable storage medium, which stores a computer program. The computer program can be executed by the processor 11 to complete the method for identifying the ship berthing area provided in the present application.
[0059] See also Figure 3 , is a flow chart of a method for identifying a ship berthing area provided in an embodiment of the present application, such as Figure 3 As shown, the method may include the following steps 310 to 330.
[0060] Step 310: Acquire an AIS data set within a period of time to be identified in the area to be identified, and pre-process the AIS data set to obtain a waypoint set; wherein the waypoint set includes multiple waypoints, and each waypoint includes a waypoint longitude, a waypoint latitude, and a waypoint time.
[0061] The area to be identified is an area where mooring area identification is required, and can be configured as needed. For example, if mooring area identification is to be performed on the waters within the province A and the surrounding sea areas, the area to be identified can be the waters within the province A and the surrounding sea areas.
[0062] The period to be identified is the period during which the anchoring area identification is required, that is, the period during which the AIS data is generated. For example, if the anchoring area identification is to be performed on the AIS data of the entire month of March, the period to be identified is the entire month of March.
[0063] The server side that performs the method for identifying the ship's berthing area can obtain multiple AIS data in the period of time to be identified in the area to be identified from the server that provides AIS data, and these AIS data constitute an AIS data set. Each AIS data corresponds to a waypoint, which is the position (expressed by waypoint longitude and waypoint latitude) and time (expressed by waypoint time) of the ship during berthing or sailing.
[0064] Preprocessing is performed on multiple AIS data of the AIS data set, so as to clean and filter the data to obtain multiple waypoints in the area to be identified during the period to be identified, and the waypoints constitute a waypoint set. All waypoints in the waypoint set can represent the positions of multiple ships in the area to be identified during the period to be identified.
[0065] Step 320: Based on the specified DBSCAN algorithm, multiple waypoints in the waypoint set are clustered on the basis of a preset density threshold and a target area radius to obtain a plurality of clusters; wherein the distance algorithm in the specified DBSCAN algorithm is a haversine formula.
[0066] The traditional DBSCAN algorithm generally uses Euclidean distance as the distance algorithm. However, because the earth is a three-dimensional structure that approximates a sphere, the shortest distance between two points on the sphere is not necessarily a straight line, but a spherical distance. Therefore, the traditional DBSCAN algorithm is not suitable for calculating the shortest distance between two waypoints. To solve this problem, this solution uses the haversine formula as the distance algorithm and changes the traditional DBSCAN algorithm to the specified DBSCAN algorithm.
[0067] Exemplarily, the haversine formula as a distance algorithm can be expressed by the following formula (1):
[0068]
[0069] Where hd is the distance between the two waypoints; r is the radius of the earth in meters; Δlat is the difference in latitude, i.e. lat2-lat1; lat1 and lat2 are the latitudes of the two waypoints (expressed in radians); Δlon is the difference in longitude, i.e. lon2-lon1; lon1 and lon2 are the longitudes of the two waypoints (expressed in radians).
[0070] By taking the location information, density threshold and target area radius of multiple waypoints in the waypoint set as inputs of the specified DBSCAN algorithm, several clusters output by the specified DBSCAN algorithm can be obtained, wherein each cluster includes multiple waypoints.
[0071] See also Figure 4 , which is a schematic diagram of the waypoint clustering effect provided by an embodiment of the present application, such as Figure 4 As shown in the figure, the matrix data on the left represents a waypoint set, each row of data corresponds to a waypoint, and the three data in each row are the waypoint longitude, waypoint latitude and waypoint time. By performing cluster analysis on the waypoint set, several clusters can be obtained. Figure 4 After cluster analysis of the waypoints in , two clusters are obtained as shown on the right, located in the lower left corner and the upper right corner respectively.
[0072] Here, the process of clustering using the specified DBSCAN algorithm is described: the location information of multiple waypoints in the waypoint set, the density threshold MinPts, and the target area radius EPS are used as inputs of the specified DBSCAN algorithm, and the semi-vector formula is specified as the distance algorithm.
[0073] First, an unmarked set may be initialized, which is a set of unmarked waypoints. When the unmarked set is first constructed, all waypoints in the waypoint set are directly used as waypoints in the unmarked set.
[0074] In the second step, a waypoint is randomly selected from the unlabeled set, denoted as object p.
[0075] In the third step, the ball_tree data structure is used to quickly search for another waypoint in the unmarked set, denoted as object q, and the semi-vector formula is used to calculate the distance between object p and object q, which is denoted as dist(p,q). If the distance dist(p,q) is less than or equal to the target area radius EPS, then object q is a neighbor of object p. Through iterative query, all neighbors of object p can be obtained to form the neighbor point set B of object p.
[0076] Step 4: If the total number of neighbors in the neighbor point set B of object p is not less than the density threshold MinPts, create a temporary cluster d1, mark object p as a core point, and assign object p to temporary cluster d1. Add each element in the neighbor point set B to the candidate set N.
[0077] Step 5: If the total number of neighbors in the neighbor point set B is less than the density threshold MinPts and the candidate set N is not empty, create a temporary boundary point set M, mark the object p as a boundary point, and add the object p to the temporary boundary point set M.
[0078] Step 6: If the total number of neighbors in the neighbor point set B is less than the density threshold MinPts and the candidate set N is empty, the object p is marked as a noise point.
[0079] Step 7. For each point p in the candidate set N, the process from step 3 to step 6 can be repeated to continuously remove the traversed points p from the candidate set N. The candidate set N is empty when the iteration ends.
[0080] Step 8: Based on the temporary clusters {d1, ..., dl} and the temporary boundary point set M, they are merged into a cluster C1. The randomly selected elements in the second step are removed from the unlabeled set. Here, the serial number of the temporary cluster is updated while repeating steps 3 to 6.
[0081] Step 9: Repeat the process from step 2 to step 8. A new cluster can be obtained in each iteration.
[0082] In the tenth step, when the unlabeled set is empty, the DBSCAN algorithm is specified to terminate. At this time, multiple clusters are obtained.
[0083] Step 330: According to the plurality of clusters, determine a parking area corresponding to each cluster.
[0084] After obtaining several clusters, it can be considered that each cluster corresponds to a parking area, and the overall position of the parking area corresponding to the cluster can be determined based on the location information of multiple waypoints on the boundary of the cluster. After determining the parking areas for all clusters, several parking areas of the to-be-identified area during the to-be-identified period can be obtained.
[0085] Through the above measures, the AIS data of the identification area in the identification period are clustered, and the ship's berthing area can be effectively identified. Moreover, by setting the specified DBSCAN algorithm containing the haversine formula, the distance between different ships can be accurately calculated during the clustering process, thereby obtaining accurate clustering results and correspondingly obtaining an accurate berthing area.
[0086] In one embodiment, see Figure 5 , is a schematic diagram of the AIS data preprocessing process provided by an embodiment of the present application, such as Figure 5 As shown, the method may include the following steps 510 to 540.
[0087] Step 510: Attribute selection is performed on each piece of AIS data in the AIS data set to obtain a plurality of selected AIS data; wherein each piece of selected AIS data includes a ship identification code, waypoint longitude, waypoint latitude and waypoint time.
[0088] Each piece of AIS data may include attribute data such as ship identification code (MMSI, Maritime Mobile Service Identity), ship information, navigation status information, location information, speed and heading. In this solution, complete AIS data is not required, so attribute selection can be performed on each piece of AIS data as needed, and the required attribute data can be selected to obtain the selected AIS data. Exemplarily, the selected AIS data may include the attribute data shown in Table 1 below:
[0089] Field Name Field Description Data Range MMSI Vessel identification code Nine-digit code LON longitude [-180°,180°] LAT latitude [-90°,90°] SOG Ground speed [Section 0, Section 102.2] COG Course over ground 0.01°,[0.3599] ROT Turn rate 0.01° / s,[-1200,1200] TIME_FLAG Time stamp Timestamp
[0090] Table 1
[0091] During the selection process, it can be checked whether the data in the attribute data of each piece of AIS data is within the correct data range. If not, it can be determined that the AIS data has an error and the AIS data can be deleted.
[0092] Step 520: Filter out the selected AIS data located on land from the multiple selected AIS data.
[0093] After obtaining multiple selected AIS data, a point-to-surface overlay analysis can be performed on the waypoints and land vectors indicated by each selected AIS data to determine whether the waypoints corresponding to the selected AIS data are on land. On the one hand, if the waypoints corresponding to any selected AIS data are on land, it means that there is an error in this data and it can be deleted. On the other hand, if the waypoints corresponding to any selected AIS data are not on land, this data can be retained.
[0094] This measure allows waypoints that appear on land to be deleted, thus preventing erroneous data from interfering with subsequent calculations.
[0095] Step 530: Determine and remove the selected AIS data corresponding to the same ship identification code in the filtering result, and perform deduplication processing to obtain deduplication AIS data; wherein the deduplication processing is to merge at least a specified number of continuous selected AIS data with the same position information into one AIS data.
[0096] The same ship may have repeated location information at adjacent time points (adjacent waypoint times), which is caused by the ship's continuous stay at the same location. In this case, the same ship will generate multiple AIS data at a certain location, resulting in excessive data volume and excessive repeated invalid data, which interferes with subsequent cluster analysis and makes the identification of the berthing area inaccurate. To solve this problem, the AIS data that appears at adjacent time points for the same ship can be de-duplicated and merged. In addition, not all AIS data of the same ship at the same location are de-duplicated and merged. If the same ship has the same location information in the AIS data of two waypoint times that are far apart, such AIS data can characterize the berthing status of the ship without de-duplication and merging. Therefore, the specified number of adjacent time points selected cannot be too large. Here, the specified number can be configured as needed. Exemplarily, the specified number can be any one of 2, 3, 4, etc.
[0097] For the multiple selected AIS data corresponding to each ship identification code, it can be checked whether there are at least a specified number of continuous selected AIS data with the same location information. In other words, whether the ship identification code has at least a specified number of adjacent AIS data with the same location information.
[0098] On the one hand, if there are a specified number of consecutive selected AIS data with the same position information for any ship identification code, these selected AIS data can be merged into one AIS data, where the waypoint time of the merged AIS data can be the earliest time, the latest time or any time among the multiple selected AIS data with the same position information. After one or more groups of selected AIS data for any ship identification code are merged, the deduplicated AIS data corresponding to the ship identification code can be obtained.
[0099] On the other hand, if there are no consecutive specified number of selected AIS data with the same position for any ship identification code, there is no need to merge them. It can be considered that the selected AIS data corresponding to the ship identification code is the deduplicated AIS data corresponding to the ship identification code.
[0100] Step 540: Determine whether the number of waypoints indicated by the AIS data after deduplication of each ship identification code reaches the waypoint number threshold. If so, add the waypoint corresponding to the ship identification code to the waypoint set.
[0101] For each ship identification code, determine the number of deduplicated AIS data corresponding to the ship identification code as the number of waypoints indicated by the deduplicated AIS data, and determine whether the number reaches the waypoint number threshold. Here, the waypoint number threshold is used to screen valid waypoints. When the number of waypoints corresponding to any ship identification code is less than the waypoint number threshold, it can be considered that the deduplicated AIS data corresponding to the ship identification is too sparse. At this time, the data of the ship identification code will affect the accuracy of the subsequent cluster analysis. In this case, the waypoint corresponding to the ship identification code can be filtered out.
[0102] On the one hand, if the number does not reach the waypoint quantity threshold, the waypoint corresponding to the ship identification code can be filtered out. On the other hand, if the data reaches the waypoint quantity threshold, the waypoint corresponding to the ship identification code can be added to the waypoint set.
[0103] Exemplarily, the waypoint set can be expressed by the following formula (2):
[0104]
[0105] Among them, d ij ,1≤i≤n,1≤j≤3 represents the jth value of the ith element (the element is a waypoint) in the waypoint set. The three values of the ith element in the waypoint set are the waypoint longitude, the waypoint latitude, and the waypoint time. For example: d 11 Indicates the first value of the first element, which is the longitude of the first waypoint. 22 Represents the second value of the second element, which is the waypoint latitude of the second waypoint.
[0106] Through the above measures, the preprocessing of AIS data can be completed to obtain a waypoint set.
[0107] In one embodiment, after executing step 530, a waypoint quantity threshold may be generated. Based on the deduplicated AIS data corresponding to each ship identification code, the number of waypoints corresponding to each ship identification code may be determined, and the average and standard deviation of the number of waypoints corresponding to all ship identification codes may be calculated.
[0108] After obtaining the average and standard deviation of the number of waypoints, the waypoint number threshold can be determined according to the average, the preset adjustment coefficient and the standard deviation. The adjustment coefficient can be an empirical value, and exemplarily, the value of the adjustment coefficient is between 2 and 3.
[0109] Exemplarily, the calculation process of the waypoint quantity threshold is represented by the following formula (3):
[0110] F=μ-k*σ (3)
[0111] Among them, F is the waypoint quantity threshold; μ is the mean; k is the adjustment coefficient; σ is the standard deviation.
[0112] In one embodiment, see Figure 6 , is a flow chart of a method for determining a target area radius provided in an embodiment of the present application, such as Figure 6 As shown, the method may include the following steps 610 to 620.
[0113] Step 610: Calculate the distance between every two waypoints in the waypoint set based on the haversine formula to obtain multiple distances.
[0114] The waypoints in the waypoint set can be combined in pairs to obtain multiple waypoint pairs, and for each waypoint pair, the distance between the two waypoints in the waypoint pair is calculated using the aforementioned formula (1), thereby obtaining multiple distances.
[0115] Step 620: sort the multiple distances, and select the nth distance from the sorted multiple distances in ascending order as the target area radius; wherein n is calculated by the total number m of the multiple distances and a preset weight coefficient k.
[0116] After obtaining multiple distances, n can be calculated based on the total number m of the multiple distances and the weight coefficient k. Here, the weight coefficient can be configured based on experience. For example, the value range of the weight coefficient is between 0.001 and 0.01.
[0117] The multiple distances are sorted, and the nth distance is selected from the sorted multiple distances in order from small to large, and the distance can be used as the radius of the target area.
[0118] In one embodiment, the average time complexity of the DBSCAN algorithm is O(nlogn). However, in the case of massive ship data, its time complexity may reach O(nlogn). 2 ), the DBSCAN algorithm is slow when processing massive data.
[0119] To solve this problem, the waypoint set can be further fragmented based on the spatial dimension fragmentation rule and the temporal dimension fragmentation rule to obtain multiple subsets, wherein each subset includes multiple waypoints.
[0120] The spatial dimension sharding rule indicates that the waypoint set is sharded from the spatial dimension. For example, the spatial dimension sharding rule is to shard the waypoints of each province, so that the waypoints in the waypoint set can be divided by province, for example, in the spatial dimension, the waypoints in Chongqing are grouped into one group, and the waypoints in Sichuan Province are grouped into one group, etc.
[0121] The time dimension sharding rule indicates that the waypoint set is sharded from the time dimension. Exemplarily, the time dimension sharding rule is sharding once every three days.
[0122] Through the spatial dimension sharding rules and the time dimension sharding rules, joint sharding can be performed on the spatial dimension and the time dimension, so that the amount of data in each subset is small.
[0123] After obtaining multiple subsets, for each subset, multiple waypoints in the subset can be clustered based on a preset density threshold and a target area radius based on a specified DBSCAN algorithm to obtain a number of clusters corresponding to the subset.
[0124] By taking the location information, density threshold and target area radius of multiple waypoints in any subset as the input of the specified DBSCAN algorithm, several clusters corresponding to the subset output by the specified DBSCAN algorithm can be obtained. After clustering all subsets, the clusters corresponding to all subsets can be obtained.
[0125] The clusters corresponding to different subsets can overlap, overlap, and intersect. For example, waypoints in the same ship gathering area are divided into different subsets at different times. The clusters corresponding to these subsets can be considered as the performance of the same ship gathering area at different times. In this case, when determining the berthing area based on the obtained clusters, the clusters corresponding to multiple subsets can be merged first.
[0126] See also Figure 7 , is a flow chart of a method for determining a parking area provided in an embodiment of the present application, such as Figure 7 As shown, the method may include the following steps 710 to 750.
[0127] Step 710: construct a number of clusters corresponding to each subset into a cluster set.
[0128] After the clusters corresponding to the respective subsets are obtained, the clusters of all the subsets may be constructed into a cluster set.
[0129] Step 720: Determine whether there is overlap between any two clusters in the cluster set.
[0130] For any cluster in the cluster set, it can be determined whether the cluster overlaps with other clusters (the regions where the clusters are located overlap). This process can be achieved through traversal or through a dynamic programming method.
[0131] Step 730: If any two clusters overlap, the overlapping clusters are merged to obtain a merged cluster, and the merged cluster is added to the cluster set.
[0132] When it is determined that any two clusters overlap, the two clusters can be merged to obtain a merged cluster, which can be added to the cluster set as a new cluster. The merged cluster can be deleted from the cluster set.
[0133] Step 740: Return to the step of determining whether any two clusters in the cluster set overlap, until no overlapping clusters exist in the cluster set.
[0134] After each round of merging, the process may return to step 720 to start a new round of merging. After repeated iterations, when there are no overlapping clusters in the cluster set, the merging process may be stopped to obtain the final cluster set.
[0135] Step 750: Determine the parking area corresponding to each cluster in the cluster set.
[0136] After obtaining the final cluster set, the overall position of the parking area corresponding to the cluster can be determined based on the location information of multiple waypoints on the boundary of each cluster in the cluster set. After determining the parking areas for all clusters, several parking areas of the to-be-identified area during the to-be-identified period can be obtained.
[0137] Through this measure, the waypoint set is fragmented, and then each subset obtained by the fragmentation is clustered, and the processing results corresponding to each subset are clustered and merged, which can greatly reduce the time complexity of the DBSCAN algorithm and improve the clustering efficiency.
[0138] In one embodiment, the time dimension sharding rule indicates the time span corresponding to a single subset. Before the waypoint set is sharded according to the space dimension sharding rule and the time dimension sharding rule, the time span corresponding to the single subset can be determined.
[0139] The total number of waypoints of a single data shard is determined according to the upper limit of available memory and the maximum memory consumption of a single data shard. Here, the upper limit of available memory is the maximum value (in megabytes) of the available memory of the server that executes the identification method of the ship berthing area; the maximum memory consumption (in megabytes) of a single data shard is the maximum value of the memory occupied by a single data shard during the clustering process.
[0140] After the total number of waypoints of a single data shard is obtained, the time span corresponding to a single subset may be determined according to the total number of waypoints of the single data shard and the total number of waypoints of the waypoint set.
[0141] Exemplarily, the calculation method of the time span corresponding to a single subset can be expressed by the following formula (4):
[0142]
[0143] Among them, MinTs is the time span corresponding to a single subset; M is the upper limit of available memory; m is the maximum memory consumption of a single data shard; M / m is the total number of waypoints in a single data shard; N is the total number of waypoints in the waypoint set; d is the adjustment factor, which is an empirical value, usually an integer, such as 1 or 2.
[0144] In one embodiment, after obtaining a plurality of clusters, a convex hull may be generated for each cluster, and a parking area corresponding to the cluster may be determined based on the boundary position of the convex hull to obtain the parking area corresponding to the cluster. After generating the convex hull for each cluster, the parking areas corresponding to all clusters may be obtained.
[0145] By adopting this measure, when the parking area is determined by each cluster, the range of the parking area can be effectively identified by generating a convex hull for the cluster.
[0146] Figure 8 FIG. 1 is a block diagram of a device for identifying a ship berthing area according to an embodiment of the present invention. Figure 8 As shown, the device may include:
[0147] The preprocessing module 810 is used to obtain an AIS data set within a period of time to be identified in the area to be identified, and preprocess the AIS data set to obtain a waypoint set; wherein the waypoint set includes multiple waypoints, each waypoint includes a waypoint longitude, a waypoint latitude and a waypoint time;
[0148] A clustering module 820 is used to perform clustering processing on the multiple waypoints in the waypoint set based on a preset density threshold and a target area radius based on a specified DBSCAN algorithm to obtain a plurality of clusters; wherein the distance algorithm in the specified DBSCAN algorithm is a haversine formula;
[0149] The determination module 830 is configured to determine, based on the plurality of clusters, a parking area corresponding to each cluster.
[0150] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned ship berthing area identification method, and will not be repeated here.
[0151] In several embodiments provided in the present application, the disclosed devices and methods may also be implemented in other ways. The device embodiments described above are merely schematic, for example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram may represent a module, a program segment or a part of a code, and a module, a program segment or a part of a code contains one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they may sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0152] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0153] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
Claims
1. A method for identifying a ship berthing area, characterized in that: include: Acquire an AIS data set within a period of time to be identified in the area to be identified, and pre-process the AIS data set to obtain a waypoint set; wherein the waypoint set includes a plurality of waypoints, each waypoint including a waypoint longitude, a waypoint latitude, and a waypoint time; Based on the specified DBSCAN algorithm, multiple waypoints in the waypoint set are clustered on the basis of a preset density threshold and a target area radius to obtain a plurality of clusters; wherein the distance algorithm in the specified DBSCAN algorithm is a haversine formula; According to the plurality of clusters, a parking area corresponding to each cluster is determined.
2. The method according to claim 1, characterized in that The preprocessing of the AIS data set to obtain a waypoint set includes: Performing attribute selection on each piece of AIS data in the AIS data set to obtain a plurality of selected AIS data; wherein each piece of selected AIS data includes a ship identification code, a waypoint longitude, a waypoint latitude, and a waypoint time; Filtering out the selected AIS data located on land from the multiple selected AIS data; Determine and remove the selected AIS data corresponding to the same ship identification code in the filtering result, and perform deduplication processing to obtain deduplication AIS data; wherein the deduplication processing is to merge at least a specified number of continuous selected AIS data with the same position information into one AIS data; Determine whether the number of waypoints indicated by the deduplicated AIS data of each ship identification code reaches the waypoint number threshold. If so, add the waypoint corresponding to the ship identification code to the waypoint set.
3. The method according to claim 2, characterized in that The method for obtaining the waypoint quantity threshold includes: Calculate the mean and standard deviation of the number of waypoints corresponding to all ship identification codes; The waypoint quantity threshold is determined according to the average, a preset adjustment coefficient and the standard deviation.
4. The method according to claim 1, characterized in that: The step of obtaining the target area radius includes: Calculate the distance between every two waypoints in the waypoint set based on the haversine formula to obtain multiple distances; The multiple distances are sorted, and the nth distance is selected from the sorted multiple distances in ascending order as the target area radius; wherein n is calculated by the total number m of the multiple distances and a preset weight coefficient k.
5. The method according to claim 1, characterized in that The specified DBSCSN algorithm performs clustering processing on multiple waypoints in the waypoint set based on a preset density threshold and a target area radius to obtain a plurality of clusters, including: Based on the spatial dimension slicing rule and the temporal dimension slicing rule, the waypoint set is sliced to obtain a plurality of subsets; wherein each subset includes a plurality of waypoints; For each subset, based on the specified DBSCSN algorithm, multiple waypoints in the subset are clustered on the basis of the preset density threshold and the target area radius to obtain several clusters corresponding to the subset; The step of determining a parking area corresponding to each cluster according to the plurality of clusters includes: Constructing a number of clusters corresponding to each subset into a cluster set; Determine whether there is overlap between any two clusters in the cluster set; If any two clusters overlap, the overlapping clusters are merged to obtain a merged cluster, and the merged cluster is added to the cluster set; Returning to the step of determining whether any two clusters in the cluster set overlap, until no overlapping clusters exist in the cluster set; A parking area corresponding to each cluster in the set of clusters is determined.
6. The method according to claim 5, characterized in that The time dimension sharding rule indicates the time span corresponding to a single subset; Before the waypoint set is fragmented based on the spatial dimension fragmentation rule and the time dimension fragmentation rule to obtain a plurality of subsets, the method further includes: Determine the total number of waypoints for a single data shard based on the upper limit of available memory and the maximum memory consumption of a single data shard; According to the total number of waypoints of a single data slice and the total number of waypoints of the waypoint set, a time span corresponding to a single subset is determined.
7. The method according to claim 1, characterized in that The step of determining a parking area corresponding to each cluster according to the plurality of clusters includes: For each cluster, a convex hull is generated for the cluster, and a parking area corresponding to the cluster is determined based on a boundary position of the convex hull to obtain a parking area corresponding to each cluster.
8. A device for identifying a ship berthing area, characterized in that: include: A preprocessing module is used to obtain an AIS data set within a period of time to be identified in the area to be identified, and preprocess the AIS data set to obtain a waypoint set; wherein the waypoint set includes multiple waypoints, each waypoint includes a waypoint longitude, a waypoint latitude and a waypoint time; A clustering module, for clustering a plurality of waypoints in the waypoint set based on a preset density threshold and a target area radius based on a specified DBSCAN algorithm to obtain a plurality of clusters; wherein the distance algorithm in the specified DBSCAN algorithm is a haversine formula; The determination module is used to determine a parking area corresponding to each cluster according to the plurality of clusters.
9. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to execute the method for identifying a ship berthing area according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program can be executed by a processor to complete the method for identifying a ship berthing area according to any one of claims 1 to 7.
