A Method for Extracting Ship Routes and Classifying Trajectories Based on AIS Data

Through AIS data preprocessing and trajectory classification methods, the problems of route calculation in the prior art are easily affected by abnormal trajectory interference and high costs, and the robustness of route extraction and precise classification of trajectory are achieved, and port operation efficiency and shipping safety are improved.

CN114647705BActive Publication Date: 2025-07-25HANGZHOU DIANZI UNIV
View PDF 1 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The prior art is susceptible to abnormal trajectory interference when calculating the port's entry route and the calculation cost is high, making it difficult to accurately judge the ship's route, affecting the port's operational efficiency and shipping safety.

Method used

Through AIS data preprocessing, route extraction and trajectory classification methods, including data screening, trajectory segmentation, downsampling, DP compression, key point clustering and route extraction, trajectory classification is performed using DBSCAN clustering and Directed Hausdorff distances to reduce abnormal trajectory interference and improve computing efficiency.

Benefits of technology

It effectively reduces the interference of abnormal trajectories, improves the robustness of route extraction and trajectory classification, reduces calculation costs, and realizes accurate classification and real-time judgment of ship trajectories.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114647705B_ABST
    Figure CN114647705B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for extracting ship routes and classifying trajectories based on AIS data. The method includes three parts: AIS data preprocessing, route extraction in the sea area, and trajectory classification; processing and analyzing historical AIS data in the target sea area to obtain effective driving trajectories of certain types of ships. Analyze the route information contained in all effective trajectories, obtain the waypoints of the route through DBSCAN clustering on different fields in two steps, and then use a custom weighted distance function to describe the distance between waypoints and connect adjacent waypoints to obtain route information. Finally, calculate the Directed Hausdorff distance using the obtained route and ship trajectory to achieve the trajectory classification work. The present invention improves the efficiency of route calculation and has good robustness, especially showing better performance on large-scale AIS data sets.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of shipping data processing, and particularly relates to a method for extracting ship routes and classifying trajectories based on AIS (Automatic Identification System) data. Background Art

[0002] With the increasing proportion of shipping in the logistics system, the safety requirements for maritime transportation are constantly growing. For this reason, the International Maritime Organization has proposed to install AIS systems. AIS data includes real-time dynamic and static information of ships, which can well describe the operating status of ships. For a shipping port, there are multiple routes approaching from different directions, and different routes have different hydrological conditions and their own characteristics. If the port and shipping agents can accurately judge the ship's route, they can better provide personalized customized services for the ship (such as: more accurate arrival time prediction, trajectory anomaly detection, etc.), improve the operating efficiency of the port, and enhance the safety of shipping.

[0003] Currently, calculating the existing routes for ships approaching the port is mainly obtained by clustering the complete trajectories of all ships calling at the port. The routes obtained by this method are easily interfered by abnormal trajectories and have a high computational cost. The present invention proposes a new idea for route extraction and trajectory classification, effectively improving the robustness of the algorithm to abnormal trajectories and greatly reducing the amount of computation. Summary of the Invention

[0004] The present invention provides a method for extracting ship routes and classifying trajectories. When extracting routes, this method can effectively reduce the interference of abnormal trajectories, and more accurately classify ship trajectories through the obtained routes.

[0005] A method for extracting ship routes and classifying trajectories based on AIS data, the steps are as follows:

[0006] S1: AIS data preprocessing, extracting effective data from the AIS data and performing downsampling processing.

[0007] S2: Route extraction, further processing the obtained trajectories to reduce the number of trajectory points as much as possible, retaining concise and effective waypoints, and finally connecting the waypoints to obtain the route.

[0008] S3: Trajectory classification, calculating the distances between the trajectories to be classified and all the obtained routes to achieve trajectory classification.

[0009] Further, the specific method of step (1) is as follows:

[0010] 1.1 Data screening: Screening out the AIS data of designated types of ships with the destination being the target port from all AIS data, and obtaining all the data generated only by the ships entering the port.

[0011] 1.2 Trajectory extraction: Reconstruct the filtered AIS data into trajectory data according to the MMSI field.

[0012] 1.3 Trajectory segmentation: Differentiate the trajectory data with the same MMSI field by Timestamp, and segment the trajectory at the point where the difference value is greater than the set difference value threshold to ensure that each trajectory data is for the same Shandong Airlines data.

[0013] 1.4 Integrity check: Check whether the distance from the last position of all trajectories to the port is less than the set distance threshold, and check whether the duration of each trajectory is longer than the set time. Trajectories that do not meet these two conditions will be discarded.

[0014] 1.5 Downsampling: Perform downsampling on the checked trajectories to expand the interval between trajectory points to an equally spaced minute level, and use linear interpolation to complete the missing AIS information corresponding to the time stamps after downsampling.

[0015] Furthermore, the specific method of step (2) is as follows:

[0016] 2.1 Trajectory compression: Use the DP compression algorithm to compress the trajectory to reduce the redundancy of trajectory points in space. The trajectory points after compression are called key points.

[0017] 2.2 Recalculate the COG information: COG represents the course over ground of the ship at the current time. Recalculate the COG information of the point through the positional relationship between the key point and the next key point so that it can correctly describe the azimuth information between the current point and the next point in a trajectory.

[0018] 2.3 Key point clustering:

[0019] What is obtained after step 2.2 are the key points in all historical trajectories, including a large number of points with similar or overlapping positions and almost the same turning directions, as well as some points with obviously incorrect directions in the normal trajectories. Use the key point clustering method based on a sliding window to delete the points with incorrect information and find all the points with similar positions and turning directions, and represent them with waypoints.

[0020] The specific steps are as follows:

[0021] 2.3.1 Spatial position clustering: Use DBSCAN clustering on the positions of all key points falling within the scanning interval by scanning with a sliding window to find clusters of points.

[0022] 2.3.2 Steering Angle COG Clustering: Perform COG clustering on all the obtained clusters in sequence, and calculate the average longitude and latitude of all key points in each same cluster as well as the median of COG as the longitude LON, latitude LAT, and course over ground COG of the waypoint, and use the waypoint to directly represent all points in the cluster.

[0023] 2.4 Route Extraction: Manually select a waypoint from the far end as the starting point, and search for the next waypoint in the direction indicated by each waypoint COG. When searching for the next waypoint, calculate the custom weighted distance function, which comprehensively considers the distance between waypoints and the degree of direction change, and select the waypoint with the minimum weighted distance as the next waypoint. The connection of waypoints realizes the extraction of the route.

[0024] Further, the specific method of step (3) is as follows:

[0025] Obtain the real-time ship trajectory, and calculate the Directed Hausdorff distance between the real-time ship trajectory data and all the obtained routes in sequence. The closer the distance, the higher the similarity. The route with the highest similarity is the route that the ship is most likely to be traveling on.

[0026] Further, when performing data screening in step 1.1, delete the obvious error information at the same time. The obvious error information includes that the position is outside the target sea area, and the speed, ship length, width, and draft depth are outside the normal range of the target ship type.

[0027] Further, the specific method of step 2.1 is as follows:

[0028] Perform the DP (Douglas-Peucker) trajectory compression algorithm on the trajectory: There is still a large spatial redundancy in the trajectory at a time granularity of 150 seconds between the downsampled trajectory points. Performing the DP trajectory compression algorithm on the trajectory only retains the relatively key nodes in the trajectory to further reduce the redundancy.

[0029] The basic principle of the DP trajectory compression algorithm is: Assume that a trajectory starts from point p A and ends at p B , and the intermediate point set is denoted as P AB . The DP compression algorithm directly uses the start and end points of the trajectory, namely p A and p B , as the key points after compression, connect the start and end points to obtain line segment L AB , calculate the perpendicular distance from all points in the point set P AB to the line segment L AB , and obtain a point with the maximum perpendicular distance from the point set and denote it as p max , that is:

[0030]

[0031] where D(p, L AB ) is the perpendicular distance from point p to line L AB , and in this case, it is divided into two situations: 1). If D(p max , L AB ) < ε, where ε is the compression threshold set in advance according to the actual situation, then all the points between point p A and p B in the trajectory will be deleted, and the compression of the current trajectory terminates; 2). If D(p max , L AB ) ≥ ε, then p max is written as a key point after compression into the compressed trajectory. At the same time, the current trajectory is split into two trajectories at p max . And the DP compression is performed on these two segments of the trajectory respectively until the compression process of the entire trajectory ends when all the trajectories terminate due to situation 1). Then, the set of key points obtained after compression is de-duplicated and sorted according to the Timestamp field to obtain the compressed trajectory of the original trajectory. At this time, the number of key points in the compressed trajectory is much smaller than the number of points in the original trajectory. Obviously, the selection of the compression threshold ε has a decisive impact on the result of DP compression. The compression threshold should be carefully selected considering both the compression ratio and the similarity between the trajectory before and after compression. Among them, the compression ratio refers to the percentage of the points deleted after trajectory compression in the original total number of points, which is expressed by the following formula:

[0032]

[0033] where T cp , T org (ε) represent the original trajectory and the trajectory compressed with ε as the threshold respectively, and the operator |*| represents taking the number of points in the trajectory. A method based on the loss region is proposed to measure the similarity before and after compression. Let T ref represent the trajectory obtained by performing DP compression under a certain larger threshold, A ref be the area of the region enclosed by T ref and T org , and A(ε) represent the area of the part enclosed by the compressed trajectory T cp (ε) obtained by compressing the trajectory with ε as the threshold and the original trajectory T org . The similarity between the trajectory before and after compression can be calculated by the following formula:

[0034]

[0035] Furthermore, the above-mentioned key point clustering method based on a sliding window is specifically as follows:

[0036] Sliding window clustering in the longitude direction. Define a strip-shaped sliding window that moves along the direction of increasing longitude of the data area. Perform DBSCAN clustering on all key points that fall into the sliding window. There may be multiple clusters of key points distributed at different positions in the sliding window. Filter out interference points through DBSCAN clustering. When the movement of the active window covers the entire area, the scanning in the longitude direction ends. Then perform scanning in the latitude direction using the same method to obtain all existing clusters of key points. The width of the sliding window and the step size of the sliding are selected according to the actual situation.

[0037] Further, the specific steps for route extraction are as follows:

[0038] 1) Manually select the distal starting point of the route and regard the starting point as a current point

[0039] 2) All other waypoints that fall into a rectangular area Pm centered on the current point, with a length of four longitudes and a height of two latitudes, are candidate points, that is

[0040] 3) Calculate the weighted distance between the current point W m and all candidate points as follows:

[0041]

[0042] where p n ∈P m , d n (p n , W m ) is the distance from the candidate point p n to the current point W m , δ(p n , W m ) is the required angle change value when the current point changes to the candidate point p n direction, d ref and δ ref are two normalization constants, which are selected flexibly according to the case;

[0043] 4) Select the next waypoint as the point that makes this weighted distance value the smallest, that is:

[0044]

[0045] 5) Take W m+1 as the current point and continue through steps 2), 3), and 4) until near the target port, obtaining a series of waypoints, and thus a route can be obtained. Selecting multiple different starting points can obtain multiple routes.

[0046] The beneficial effects of the present invention are as follows:

[0047] The present invention provides a method for extracting a route through historical data in an unknown sea route area and classifying ship trajectories in real time using the obtained route. This method can overcome the influence brought by abnormal trajectories and has a small calculation cost at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 It is the overall flowchart of the ship route extraction and trajectory classification method based on AIS data of the present invention;

[0049] Figure 2 It is the flowchart of AIS data preprocessing;

[0050] Figure 3 It is the flowchart of the route extraction part;

[0051] Figure 4 It is the schematic diagram of region-based trajectory similarity measurement proposed by the present invention;

[0052] Figure 5 It is the curve graph of compression ratio and similarity under different compression thresholds;

[0053] Figure 6 It is the schematic diagram of clustering based on a sliding window proposed by the present invention;

[0054] Figure 7 It is the route extracted in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0055] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments of the invention are some but not all of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.

[0056] The AIS data set used in the embodiments of the present invention comes from the historical AIS data provided by the DMA (Danish Maritime Authority). The historical AIS data provided by the DMA is in the format of "*.csv" and contains 26 fields, including ship identification information (such as MMSI), navigation-related information (Lon, Lat, COG), and ship voyage information (such as Destination). The following table shows the meanings of several main AIS fields used in the embodiments:

[0057]

[0058]

[0059] A method for extracting ship routes and classifying trajectories based on AIS data provided by the present invention is mainly composed of two parts as Figure 1 shown. First, the AIS data is preprocessed to determine the research objects in the target sea area, then the route is extracted on the target sea area, and finally, the real-time ship trajectories are classified and recognized according to the obtained routes. The specific implementation steps are as follows:

[0060] S1: AIS data preprocessing. Preliminary data cleaning is performed on the original data to delete obvious error information and focus on the data in the target sea area. After the preprocessing part, complete trajectories passing through the target sea area and with the destination being the target port will be obtained (in this embodiment, it is the sea area near the SKAGEN port in Denmark). As Figure 2 shown, the specific implementation steps of this part are as follows:

[0061] 1.1 Data screening: From all AIS data, all AIS data of designated types of ships (in this embodiment, large oil tankers with a length greater than 180 meters) whose destinations are the target port and pass through the target sea area are screened according to four fields: Destination, Ship type, Latitude, and Longitude. At the same time, obvious error information is deleted, such as the position being outside the target sea area, and the speed, ship length, width, and draft depth being outside the normal range of the target ship type.

[0062] 1.2 Trajectory extraction: Since AIS data is discrete information, the original data is the states (latitude and longitude, speed, steering, etc.) of different ships at different times, and there is no any association between each piece of data. It is necessary to connect the discrete data into a complete trajectory. For this purpose, all MMSIs in the AIS data are found, and the AIS data is grouped according to MMSIs. The data with the same MMSI comes from the same ship, and it is sorted and de-duplicated according to the Timestamp field to obtain the trajectory data of the ship. However, the data obtained at this time may include the trajectories of the ship's multiple voyages.

[0063] 1.3 Trajectory segmentation: The purpose of trajectory segmentation is to segment the multiple trajectories of a ship. The specific method is to perform a difference operation on the trajectory data of the same ship according to the Timestamp field. The difference value represents the time interval between two reports of AIS data. If the interval is within 2 hours, it is considered as the trajectory of the same voyage. When the interval is greater than 2 hours, taking this moment as the boundary, the data before this moment and the data after this moment (including this moment) are used as two different voyage records to divide the trajectory into two segments. After the trajectory segmentation operation, it can be ensured that the data in each trajectory is generated by the same voyage.

[0064] 1.4 Trajectory validity check: Check the validity of each obtained trajectory. On the one hand, check whether the duration of the trajectory is long enough. Taking 6 hours as the threshold, trajectories with a duration less than 6 hours will be deleted. On the other hand, check whether the geographical location where the trajectory ends is close enough to the target port. If this distance is greater than 10 kilometers, the trajectory will also be deleted. Finally, only trajectories with a duration greater than 6 hours and the end point less than 10 kilometers away from the port are retained.

[0065] 1.5 Downsampling: The trajectories after the trajectory validity check are maintained at the original time granularity, that is, on the order of seconds. Since the ship does not move far within a few seconds, the state changes are often small within such a short time interval. This means that there is high redundancy in the trajectory data. To further reduce redundancy, each trajectory is downsampled so that the time interval between every two adjacent trajectory points in the same trajectory is 150 seconds. The AIS information at each sampling moment is completed by linear interpolation. The specific linear interpolation method is expressed as the following formula:

[0066] t i+1 =t i +150

[0067]

[0068]

[0069] In the formula, t i is the timestamp of the previous insertion point, t i+1 is the timestamp of the next insertion point, and their interval is 150 seconds. lon i and lat i are the longitude and latitude values of the interpolation moment to be calculated. lon a , lat a , lon b , lat b respectively represent the longitude and latitude values of the two pieces of data before and after the interpolation moment. It should be noted that in the subsequent operation steps of the present invention, only the timestamp, longitude, latitude, and turning fields are required, and the turning angle needs to be recalculated separately in the subsequent steps. Therefore, only the interpolation of the timestamp and longitude and latitude is involved in the linear interpolation, and other fields are not processed.

[0070] S2: Extract the points from all historical trajectories to form a key point set, analyze the route distribution of the entire sea area from the key point set, and extract the existing route information from it. As Figure 3 shown, there are the following specific steps:

[0071] 2.1 Apply the DP (Douglas - Peucker) trajectory compression algorithm to the trajectory: Since the slow speed of ship navigation has the advantage that the change in motion state within a short period will not have a great impact on the overall trajectory shape, there is still a large spatial redundancy in the trajectory at a time granularity of 150 seconds between the down - sampled trajectory points. Applying the DP trajectory compression algorithm to the trajectory only retains the relatively key nodes in the trajectory to further reduce redundancy. Specifically, the basic principle of the DP trajectory compression algorithm is as follows: Assume a trajectory starts from point p A and ends at p B , and the set of intermediate points is denoted as P AB . The DP compression algorithm directly uses the start and end points of the trajectory, namely p A and p B as the key points after compression. Connect the start and end points to obtain line segment L AB . Calculate the perpendicular distance from all points in the point set P AB to the line segment L AB . Obtain a point with the maximum perpendicular distance from the point set and denote it as p max , that is:

[0072]

[0073] where D(p, L AB ) is the perpendicular distance from point p to line L AB . At this time, it is divided into two cases: 1). If D(p max , L AB ) < ε (ε is the compression threshold set in advance according to the actual situation), then all points between point p A and p B in the trajectory will be deleted, and the compression of the current trajectory terminates; 2). If D(p max , L AB ) ≥ ε, then p max is written as a key point after compression into the compressed trajectory. At the same time, the current trajectory is split into two trajectories at p max . And perform DP compression on these two segments of the trajectory respectively until the compression process of the entire trajectory ends when all trajectories terminate due to case 1). Then, de - duplicate and sort the set of key points obtained after compression according to the Timestamp field to obtain the compressed trajectory of the original trajectory. At this time, the number of key points in the compressed trajectory is much smaller than the number of points in the original trajectory. Obviously, the selection of the compression threshold ε will have a decisive impact on the result of DP compression. The compression threshold should be carefully selected considering both the compression ratio and the similarity between the trajectory before and after compression. Among them, the compression ratio refers to the percentage of the points deleted after trajectory compression in the original total number of points, which is expressed by the following formula:

[0074]

[0075] where \(T\) cp , \(T\) org (\(\varepsilon\)) represent the original trajectory and the trajectory compressed with \(\varepsilon\) as the threshold respectively, and the operator \(|\cdot|\) represents the number of points in the trajectory. In addition, since the current trajectory similarity measurement algorithm is not applicable to calculating the similarity between the compressed and uncompressed trajectories in the current scenario, we propose a method based on the loss region to measure the similarity before and after compression. As Figure 4 shown, use \(T\) ref to represent the trajectory obtained by DP compression under a relatively large threshold, \(A\) ref is the area of the region enclosed by \(T\) ref and \(T\) org , and \(A(\varepsilon)\) represents the area of the part enclosed by the compressed trajectory \(T\) cp (\(\varepsilon\)) and the original trajectory \(T\) org . The similarity between the trajectory before and after compression can be calculated by the following formula:

[0076]

[0077] When selecting the compression threshold, first select a relatively large threshold as a reference, and then set multiple thresholds for experiments respectively. Calculate the similarity and compression ratio and draw a curve of similarity and compression ratio as Figure 5 shown. In this embodiment, the reference threshold is selected as 10 kilometers, Figure 5 and each point on the curve in represents different thresholds, which are 100m, 200m, 300m,..., 1500m, 2000m, 2500m,..., 5000m from left to right in turn. According to the change of the curve, the compression threshold \(\varepsilon = 500m\) is finally selected in this embodiment. In addition, it should be noted that the points in the compressed trajectory are called key points in subsequent operations.

[0078] 2.2 Recalculate the COG information of key points: After the interpolation operation in step 1.5 and the DP compression in step 2.1, the COG information in the original AIS data can no longer accurately capture the direction from the current key point to the next key point in the compressed trajectory. It is necessary to recalculate the COG information between points on the new trajectory so that it can correctly describe the azimuth information. The specific implementation is to traverse adjacent key points on each trajectory, take the longitude and latitude information of the two points, and use the Vincenty formula to calculate the forward angle of the latter key point relative to the former key point and update it as the COG of the former key point. Since the process of using the Vincenty formula to calculate the forward and backward angles of two known positions of longitude and latitude is relatively cumbersome, it will not be elaborated here. Each key point after recalculating the COG is represented by a tuple \((\lambda\) i , \(\varphi\) i , \(\theta\) i ), where \(\lambda\)i , φ i , θ i are the longitude, latitude, and COG of this key point respectively.

[0079] 2.3 Key point clustering: Each key point at this time contains the route information existing in the sea area. The route information is richer where there are more key points. However, too many key points will also affect the subsequent route judgment, and at the same time, the more the number, the more interference points. The DBSCAN clustering algorithm is used to further reduce the number of key points while retaining the key information, which is specifically implemented in the following two steps:

[0080] 2.3.1 Spatial position clustering: Clustering of spatial positions refers to clustering according to the (λ i , φ i ) of the key points. The key point clustering method based on the sliding window will be explained in combination with Figure 6 . Figure 6 is the sliding window clustering in the longitude direction. Define a strip-shaped sliding window with a width of 0.1 degrees and move it along the direction of increasing longitude of the data area. The moving distance each time is also 0.1 degrees. Perform DBSCAN clustering on all key points falling into the sliding window. There may be multiple key point clusters distributed at different positions in the sliding window (as shown by the circles in Figure 6 ). Through DBSCAN clustering, the filtering of interference points can be achieved. When the movement of the active window covers the entire area, the scanning in the longitude direction ends. Then, scan in the latitude direction by the same method to obtain all existing key point clusters.

[0081] 2.3.2 Steering angle COG clustering: After step 2.3.1, the position distribution information of the route can basically be obtained. To extract the route, the θ, that is, the COG information of the key points, is still needed. Therefore, in this step, DBSCAN clustering operation will be performed on the θ of the key points in the key point clusters obtained in 2.3.1. On the one hand, filter out the interfering θ. On the other hand, calculate a point (λ i , φ i , θ i ) from the cluster to replace the points of the entire cluster. This point is called the waypoint, denoted as . The longitude and latitude of the waypoint are the average of the longitudes and latitudes of all key points in the entire cluster, and the steering information θ of the waypoint is the median of all key point θ in the entire cluster. After steps 2.3.1 and 2.3.2, most of the abnormal points are deleted, and at the same time, the number of key points is reduced by an order of magnitude, obtaining waypoints with a smaller number and clearer route information.

[0082] 2.4 Route extraction: Route extraction is to find the next nearest waypoint based on the longitude, latitude, and turning angle of waypoints and connect them to form the final route. Specifically, route extraction includes the following steps:

[0083] 1) Manually select the starting point at the far end of the route and regard the starting point as the current point

[0084] 2) All other waypoints that fall within a rectangular area P m (with a length of four longitudes and a height of two latitudes) centered on the current point are candidate points, that is

[0085] 3) Calculate the weighted distance between the current point W m and all candidate points through the following formula:

[0086]

[0087] where p n ∈ P m , d n (p n , W m ) is the distance from the candidate point p n to the current point W m , δ(p n , W m ) is the required angle change value for the current point to change to the candidate point p n , d ref and δ ref are two normalization constants, which are flexibly selected according to the case;

[0088] 4) Select the next waypoint as the point that minimizes the weighted distance value, that is:

[0089]

[0090] 5) Take W m+1 as the current point and continue through steps 2), 3), and 4) until near the target port to obtain a series of waypoints, and a route can be obtained. Selecting multiple different starting points can obtain multiple routes. Figure 7 These are the eight routes extracted in this embodiment.

[0091] S3: Trajectory Classification: Input the trajectory to be classified (supporting real-time trajectory data), and calculate the Directed Hausdorff distance between the input trajectory and each obtained route. The closer the distance is, the higher the similarity between the trajectory and this route. The route with the highest similarity is the route on which the trajectory is traveling, and output it to achieve the classification of the trajectory.

[0092] Finally, it should be noted that the above is only a preferred embodiment of the present invention, which is only used to illustrate the technical solution of the present invention and is not used to limit the protection scope of the present invention. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also regarded as the protection scope of the present invention.

Claims

1. A method for extracting ship routes and classifying trajectories based on AIS data, characterized in that The steps are as follows: S1: AIS data preprocessing, extracting valid data from the AIS data and performing downsampling processing; S2: Route extraction, further processing the obtained trajectory to reduce the number of trajectory points, retaining refined and valid waypoints, and finally connecting the waypoints to obtain the route; S3: Trajectory classification, calculating the distances between the trajectories to be classified and all the obtained routes to achieve trajectory classification; The specific method of step S2 is as follows: 2.1 Trajectory compression: Using the DP compression algorithm to compress the trajectory to reduce the redundancy of trajectory points in space; the trajectory points after compression are called key points; 2.2 Recalculating the COG information: COG represents the course over ground of the ship at the current time. Recalculate the COG information of the point through the positional relationship between the key point and the next key point, so that it can correctly describe the azimuth information between the current point and the next point in a trajectory; 2.3 Key point clustering: What is obtained after step 2.2 are the key points in all historical trajectories, including a large number of points with similar or overlapping positions and almost the same turning directions, as well as some points with obviously wrong directions in abnormal trajectories; use the key point clustering method based on a sliding window to delete the points with incorrect information and find all the points with similar positions and turning directions, and represent them with waypoints; The specific steps are as follows: 2.3.1 Spatial position clustering: Perform DBSCAN clustering on the positions of all key points falling within the scanning interval through a sliding window scan to find clusters of points; 2.3.2 Course over ground (COG) clustering of turning angles: Perform COG clustering on all the obtained clusters in turn, and calculate the average longitude and latitude of all key points in each same cluster and the median of the COG as the longitude LON, latitude LAT, and course over ground COG of the waypoint, and use the waypoint to directly represent all the points in the cluster; 2.4 Route extraction: Manually select a waypoint from the far end as the starting point, and search for the next waypoint in the direction indicated by each waypoint's COG; when searching for the next waypoint, calculate a custom weighted distance function, comprehensively considering the distance between waypoints and the degree of direction change, and select the waypoint with the smallest weighted distance as the next waypoint, and the connection of waypoints realizes the extraction of the route; The specific steps of 2.4 Route extraction are as follows: 1) Manually select the far starting point of the route and regard the starting point as a current point 2) Fall within a rectangular area Ρ centered at the current point, with a length of four longitudes and a height of two latitudes m All other waypoints within it are candidate points, that is 3) Calculate the current point W by the following formula m The weighted distance to all candidate points: where p n ∈Ρ m , d n (p n , W m ) is the distance from the candidate point p n to the current point W m , and δ(p n , W m ) is the required angular change value when changing from the current point to the candidate point p n . d ref and δ ref are two normalization constants, which are flexibly selected according to the case;​​ 4) Select the point with the smallest weighted distance value as the next waypoint, that is: 5) Take W m+1 as the current point and continue through steps 2), 3), and 4) until near the target port to obtain a series of waypoints, thus obtaining a shipping route. Selecting multiple different starting points can yield multiple shipping routes.

2. The method for extracting ship routes and classifying trajectories based on AIS data according to claim 1, wherein The specific method of step S1 is as follows: 1.1 Data screening: Screen out the AIS data of designated types of ships with the destination as the target port from all AIS data to obtain all the data generated only by the ships entering the port; 1.2 Trajectory extraction: Reconstruct the screened AIS data into trajectory data according to the MMSI field; 1.3 Trajectory segmentation: Differentiate the trajectory data with the same MMSI field according to Timestamp, and segment the trajectory at the place where the difference value is greater than the set difference value threshold to ensure that each trajectory data is for the same voyage; 1.4 Integrity check: Check whether the distance from the last position of all trajectories to the port is less than the set distance threshold, and check whether the duration of each trajectory is longer than the set time. Trajectories that do not meet these two conditions will be discarded; 1.5 Downsampling: Perform downsampling on the checked trajectories to expand the interval between trajectory points to an equally spaced minute level. For the missing AIS information at the corresponding timestamps after downsampling, linear interpolation is used to complete it.

3. The method for extracting ship routes and classifying trajectories based on AIS data according to claim 2, wherein The specific method of step S3 is as follows: Obtain real-time ship trajectories, and calculate the DirectedHausdorff distance between the real-time ship trajectory data and all the obtained routes in sequence. The closer the distance, the higher the similarity. The route with the highest similarity is the route on which the trajectory is currently traveling.

4. A method for extracting ship routes and classifying trajectories based on AIS data according to claim 2, characterized in that, When screening data in step 1.1, obvious error information is deleted at the same time. The obvious error information includes that the position is outside the target sea area, and the speed, ship length, width, and draft are outside the normal range of the target ship type.

5. The method for extracting ship routes and classifying trajectories based on AIS data according to claim 2, wherein The specific method of step 2.1 is as follows: Perform the DP trajectory compression algorithm on the trajectory: There is still spatial redundancy in the trajectory at a time granularity of 150 seconds between downsampled trajectory points. Perform the DP trajectory compression algorithm on the trajectory to only retain the key nodes in the trajectory to further reduce redundancy; The basic principle of the DP trajectory compression algorithm is as follows: Assume that a trajectory starts from point p A and ends at p B . The set of intermediate points is denoted as P AB . The DP compression algorithm directly uses the start and end points of the trajectory, namely p A and p B , as the key points after compression, and connects the start and end points to obtain line segment L AB . Calculate the perpendicular distance from all points in the point set P AB to the line segment L AB . Select a point with the maximum perpendicular distance from the point set and denote it as p max , that is: where D(p, L AB ) is the perpendicular distance from point p to line L AB , and in this case, it is divided into two situations: 1). If D(p max , L AB ) < ε, where ε is the compression threshold set in advance according to the actual situation, then all the points between point p A and p B in the trajectory will be deleted, and the compression of the current trajectory terminates; 2). If D(p max , L AB ) ≥ ε, then write p max as the key point after compression into the compressed trajectory. At the same time, split the current trajectory into two trajectories at p max ; and perform DP compression on these two segments of the trajectory respectively until the compression process of the entire trajectory ends when all trajectories terminate due to case 1). Then, de-duplicate and sort the set of key points obtained after compression according to the Timestamp field to obtain the compressed trajectory of the original trajectory. At this time, the number of key points in the compressed trajectory will be much smaller than the number of points in the original trajectory; obviously, the selection of the compression threshold ε will have a decisive impact on the result of DP compression, and the compression threshold should be carefully selected considering the compression rate and the similarity before and after trajectory compression; where the compression rate refers to the percentage of points deleted after trajectory compression in the original total number of points, which is expressed by the following formula: where T org , T cp (ε) represent the original trajectory and the trajectory compressed with ε as the threshold respectively, and the operator |*| represents the number of points in the trajectory; the method based on the loss region is used to measure the similarity before and after compression, and T ref is used to represent the trajectory obtained by DP compression under a certain larger threshold, and A ref is for T ref and T org the area of the enclosed region, and A(ε) represents the area of the enclosed part of the compressed trajectory T cp (ε) and the original trajectory T org ; the similarity before and after trajectory compression is calculated by the following formula:

6. A method for extracting ship routes and classifying trajectories based on AIS data according to claim 2, characterized in that, The specific method of the key point clustering method based on the sliding window is as follows: Sliding window clustering in the longitude direction. Define a strip-shaped sliding window that moves along the direction of increasing longitude of the data area. Perform DBSCAN clustering on all key points that fall into the sliding window to filter out interference points through DBSCAN clustering. When the movement of the active window covers the entire area, the scan in the longitude direction ends. Then perform a scan in the latitude direction in the same way to obtain all existing key point clusters. The width of the sliding window and the step size of the sliding are selected according to the actual situation.

Citation Information

Patent Citations

  • Ship trajectory compression method and system based on ship behavior characteristics

    CN114219039A