Ship abnormal trajectory detection method, device, computer equipment and storage medium
By acquiring ship AIS data, calculating the trajectory angle, and using the DTW algorithm to standardize and rotate it, and calculate the minimum path value, the problem that traditional methods cannot effectively classify and detect abnormal ship trajectories is solved, and efficient and reliable abnormal trajectory detection is achieved.
Patent Information
- Application Number
- CN202211000146.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-19
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2042-08-19
AI Technical Summary
Traditional ship abnormal trajectory detection methods cannot effectively classify and detect abnormal trajectories, and the detection results lack reliability when faced with large amounts of data and are time-consuming.
By acquiring ship AIS data, the track points that meet the set requirements are screened out, the track angle is calculated, and the DTW algorithm is used to standardize and rotate them, and the minimum path value is calculated to determine the abnormal type of the track.
It achieves efficient classification detection of abnormal ship trajectories, improves the reliability and speed of detection, and is suitable for AIS big data analysis.
Smart Images

Figure CN115510946B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of AIS big data analysis, and more specifically to a method, device, computer equipment, and storage medium for detecting abnormal ship trajectories. Background Art
[0002] In recent years, maritime transport has become a primary mode of trade, and with increasing ship activity, there's a need to analyze ship trajectories, strengthen maritime oversight, and improve maritime safety. Unusual trajectories of non-fishing vessels often indicate hijacking, illegal surveying, smuggling, and other activities.
[0003] Traditional ship abnormal trajectory detection has certain limitations. It cannot classify abnormal trajectories, such as O-type abnormal trajectories, S-type abnormal trajectories, etc., and lacks detection methods for large amounts of data. This makes it time-consuming to deal with large amounts of data and the detection results lack reliability.
[0004] Therefore, it is necessary to design a new method to achieve classification detection of abnormal trajectories with high detection reliability and low time consumption. Summary of the Invention
[0005] The purpose of the present invention is to overcome the defects of the prior art and provide a method, device, computer equipment and storage medium for detecting abnormal ship trajectory.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: a method for detecting abnormal ship trajectories, comprising:
[0007] Acquire ship AIS data to obtain AIS data to be detected;
[0008] Obtain the latitude and longitude of three consecutive track points that meet the set requirements in the AIS data to be detected;
[0009] Calculate the slope of the straight line between two consecutive trajectory points in three consecutive trajectory points to obtain the angle between the two motion directions and the positive direction of the x-axis;
[0010] Calculate the difference between the angles between the two motion directions and the positive direction of the x-axis to obtain the trajectory angle;
[0011] Filter the index of the track point whose absolute value of the track angle is greater than the set angle threshold and is in the navigation state, and retain it in the list;
[0012] Grouping the list to obtain a grouping result;
[0013] According to the characteristics of S-shaped trajectory, O-shaped trajectory and irregular trajectory, three different types of trajectories with different lengths are generated to obtain abnormal trajectories;
[0014] The grouping result and the three abnormal trajectories are normalized using the DTW algorithm, the abnormal trajectories are rotated at different angles, and the minimum path value is calculated;
[0015] The abnormality type to which the grouping result belongs is determined according to the minimum path value.
[0016] A further technical solution is: the AIS data to be detected includes time, longitude and latitude, and speed.
[0017] A further technical solution is: the setting requirements include trajectory points that form triangle conditions and trajectory points whose distance between each other exceeds a set distance threshold.
[0018] A further technical solution is: grouping the list to obtain a grouping result includes:
[0019] The list is grouped based on distance to obtain a grouping result.
[0020] A further technical solution is: using the DTW algorithm to normalize the grouping result and the three abnormal trajectories, then rotating the abnormal trajectories at different angles, and calculating the minimum path value, including:
[0021] For a group containing multiple trajectory point indexes, the trajectory point coordinates from the first index value to the last index value of the group are taken out and normalized to obtain a processing result;
[0022] Rotate the abnormal trajectory with a set starting point and an interval of 5 degrees to obtain a rotation result;
[0023] The DTW algorithm is used to calculate the minimum path value of the rotation result and the processing result.
[0024] A further technical solution is: determining the abnormality type to which the grouping result belongs according to the minimum path value includes:
[0025] The types of abnormal trajectories corresponding to all the minimum path values are determined.
[0026] The present invention also provides a device for detecting abnormal ship trajectory, comprising:
[0027] A data acquisition unit is used to acquire ship AIS data to obtain AIS data to be detected;
[0028] A latitude and longitude acquisition unit is used to obtain the latitude and longitude of three consecutive track points that meet the set requirements in the AIS data to be detected;
[0029] A slope calculation unit is used to calculate the slope of the straight line between two consecutive trajectory points among three consecutive trajectory points, so as to obtain the angles between the two motion directions and the positive direction of the x-axis;
[0030] An angle difference calculation unit, used to calculate the difference between the angles between the two motion directions and the positive direction of the x-axis to obtain the trajectory angle;
[0031] a screening unit, configured to screen the indexes of the track points whose absolute values of the track angles are greater than a set angle threshold and which are in a navigation state, and retain them in a list;
[0032] a grouping unit, configured to group the list to obtain a grouping result;
[0033] an abnormal trajectory determination unit, configured to generate three different types of trajectories with different lengths according to the characteristics of the S-shaped trajectory, the O-shaped trajectory, and the irregular trajectory, so as to obtain an abnormal trajectory;
[0034] a minimum path value determining unit, configured to normalize the grouping result and the three abnormal trajectories using a DTW algorithm, rotate the abnormal trajectories at different angles, and calculate a minimum path value;
[0035] A type determination unit is used to determine the abnormal type to which the grouping result belongs according to the minimum path value.
[0036] A further technical solution is: the grouping unit is used to group the list based on distance to obtain a grouping result.
[0037] The present invention further provides a computer device, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the computer program.
[0038] The present invention also provides a storage medium, wherein the storage medium stores a computer program, and the computer program implements the above method when executed by a processor.
[0039] Compared with the prior art, the present invention has the following advantages: the present invention detects abnormal ship trajectories based on a large amount of acquired ship AIS trajectory data, classifies the abnormal trajectories using the DTW algorithm according to their characteristics, and can perform classified alarms. The present invention is suitable for AIS big data analysis, realizes classified detection of abnormal trajectories, has high detection reliability, and consumes less time.
[0040] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0042] Figure 1 A schematic diagram of an application scenario of the method for detecting abnormal ship trajectories provided by an embodiment of the present invention;
[0043] Figure 2 A schematic diagram of a flow chart of a method for detecting abnormal ship trajectories according to an embodiment of the present invention;
[0044] Figure 3 A schematic diagram of a sub-process of a method for detecting abnormal ship trajectories according to an embodiment of the present invention;
[0045] Figure 4 The S-shaped abnormal trajectory diagram provided by the embodiment of the present invention;
[0046] Figure 5 The O-type trajectory abnormal trajectory diagram provided by the embodiment of the present invention;
[0047] Figure 6 An irregular trajectory abnormal trajectory diagram provided by an embodiment of the present invention;
[0048] Figure 7 A schematic diagram of abnormal ship trajectory detection results provided by an embodiment of the present invention;
[0049] Figure 8 A schematic block diagram of a device for detecting abnormal ship trajectory according to an embodiment of the present invention;
[0050] Figure 9 A schematic block diagram of a minimum path value determination unit of a device for detecting abnormal ship trajectory according to an embodiment of the present invention;
[0051] Figure 10 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0052] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0053] It will be understood that when used in this specification and the appended claims, the terms “comprises” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0054] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the present invention. As used in the specification and appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0055] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0056] See also Figure 1 and Figure 2 , Figure 1 Schematic diagram of an application scenario of the method for detecting abnormal ship trajectories provided in an embodiment of the present invention. Figure 2 A schematic flowchart of a method for detecting abnormal ship trajectories provided in an embodiment of the present invention. This method is applied to a server that interacts with a ship's Automatic Identification System (AIS). The server acquires AIS (Automatic Identification System) data, performs abnormal trajectory detection on a large amount of ship trajectory data, and classifies abnormal trajectories using a DTW (Dynamic Time Warping) algorithm. Abnormal ship trajectories are detected and classified based on the relationship between abnormal trajectory features and abnormal trajectory points in the AIS data.
[0057] Figure 2 FIG. 1 is a flow chart of a method for detecting abnormal ship trajectories according to an embodiment of the present invention. Figure 2 As shown, the method includes the following steps S110 to S190.
[0058] S110: Acquire ship AIS data to obtain AIS data to be detected.
[0059] In this embodiment, the AIS data to be detected includes time, longitude and latitude, and speed, mainly the ship's MSI number, track point longitude and latitude, speed, and time.
[0060] S120: Obtain the latitude and longitude of three consecutive track points that meet set requirements in the AIS data to be detected.
[0061] In this embodiment, the set requirements include trajectory points forming a triangle condition and trajectory points whose distance between each other exceeds a set distance threshold.
[0062] Specifically, the latitude and longitude of three consecutive trajectory points are read each time, and trajectory points that do not meet the conditions for forming a triangle and points that are too far apart are skipped.
[0063] S130 , calculating the slope of the straight line where two consecutive trajectory points are located among the three consecutive trajectory points, to obtain the angles between the two movement directions and the positive direction of the x-axis.
[0064] In this embodiment, the slopes of the straight lines where the two trajectory points are located are calculated, and the angle (-180 to 180) between the moving direction and the positive direction of the x-axis is obtained.
[0065] Specifically, the angle between the linear motion direction of two consecutive points and the positive direction of the x-axis (due east direction) is calculated, and the difference between the two angles is calculated to obtain the rotation angle.
[0066] S140: Calculate the difference between the angles between the two movement directions and the positive direction of the x-axis to obtain the trajectory angle.
[0067] In this embodiment, the track angle refers to the difference between two angles between three consecutive track points.
[0068] Calculate the difference between the two angles of three consecutive trajectory points as the trajectory angle. The clockwise angle is negative and the counterclockwise angle is positive. The index of the trajectory point whose absolute value of the trajectory angle is greater than 30 degrees is retained.
[0069] S150: Filter the indexes of the track points whose absolute values of the track turning angles are greater than a set angle threshold and are in a navigation state, and retain them in a list.
[0070] In this embodiment, the indexes of the trajectory points whose absolute values of the trajectory turning angles are greater than 30 degrees are retained, and the indexes of all the trajectory points whose absolute values of the turning angles are greater than 30 degrees and are in the navigation state are retained in a list [Xi, Xj, Xk, Xq, ..., Xn].
[0071] S160: Group the list to obtain a grouping result.
[0072] In this embodiment, the grouping result refers to the result of grouping the track corners in the list.
[0073] Specifically, the list is grouped based on distance to obtain a grouping result.
[0074] Specifically, the calculated list is grouped, and the distance between adjacent large turning corner points is calculated first. If the distance is greater than the set threshold k, then another grouping is started until all corner groupings are completed, completing the grouping of large turning trajectory point indexes [[Xi,…,Xj], [Xw,…,Xe], [Xk,…,Xv]…].
[0075] S170 , generating three different types of trajectories with different lengths according to the characteristics of the S-shaped trajectory, the O-shaped trajectory, and the irregular trajectory to obtain an abnormal trajectory.
[0076] In this embodiment, the abnormal trajectory refers to three different types of trajectories with different lengths that are manually generated based on the characteristics of a serpentine trajectory, a wandering trajectory, and an irregular trajectory.
[0077] Since there are many possible lengths of abnormal trajectories, different types of artificially generated abnormal trajectories also contain various lengths and are accompanied by random fluctuations to simulate ship trajectories.
[0078] like Figures 4 to 6 As shown, when non-fishing vessels have abnormal trajectories, they are usually related to illegal mapping, hijacking, smuggling, etc. The ship's trajectory usually includes large-angle turns for a short time and short distance, and is lower than the normal sailing speed. This embodiment summarizes the relationship between three types of abnormal trajectories and these data. If the ship is sailing normally, generally within a period of time, the trajectory will not have repeated large changes in direction and will travel at a lower speed, and will sail in a straight line as much as possible. This trajectory is a normal trajectory. If large turns are continuously made within a certain area, the ship's trajectory is considered abnormal. The specific classification of abnormal ship trajectories is as follows:
[0079] (1) O-shaped trajectory. When a ship's trajectory is approximately O-shaped, it is not moored or sailing normally, so it is considered an abnormal trajectory. When a ship has an O-shaped trajectory, it may be in illegal detection or wandering. At this time, the ship's trajectory points include continuous large-angle turns in the same direction and the speed will be lower than the normal sailing speed.
[0080] (2) S-shaped motion trajectory. When the ship's trajectory is approximately S-shaped, the ship may be in an illegal surveying state. In this case, the ship's trajectory points contain continuous large-angle trajectory points with different signs.
[0081] (3) Irregular trajectory. When the ship's trajectory is irregular, the ship may have a fault. In this case, the ship may have both S-shaped and O-shaped trajectories, which are complex and contain many large turning points.
[0082] S180 , using the DTW algorithm to normalize the grouping result and the three abnormal trajectories, then rotating the abnormal trajectories at different angles, and calculating the minimum path value.
[0083] The DTW algorithm is used to calculate the found trajectory points containing large turning angles and the artificially generated abnormal trajectory. If the number of trajectory indices is less than 5, it is skipped. The two calculated trajectories are first normalized (coordinates are unified within the range of 0-100). Due to the unknown and random starting points of local abnormal trajectories, the artificially generated abnormal trajectory needs to be rotated at different angles and calculated separately, and the minimum result is taken.
[0084] In one embodiment, see Figure 3 , the above-mentioned step S180 may include steps S181 to S183.
[0085] S181 . For a group containing multiple trajectory point indexes, obtain the trajectory point coordinates from the first index value to the last index value of the group, and perform normalization processing to obtain a processing result.
[0086] In this embodiment, the processing result refers to a result obtained by taking out the coordinates of the trajectory points from the first index value to the last index value of a group containing multiple trajectory point indexes and performing normalization processing on the coordinates.
[0087] Generally speaking, if a ship makes only one or two large turns during navigation, this is normal, so groups with fewer than five turns are skipped. For groups containing multiple turn indexes, the coordinates of the track points from the first to the last index value of the group are taken and normalized: track point s(lon,lat)=>s(X,Y); X=lon / (lon.max–lon.min)*100; Y=lat / (lat.max-lat.min)*100; the coordinate axis range is then transformed to 0-100, unifying the coordinate range with that of manually generated abnormal tracks.
[0088] S182: Rotate the abnormal trajectory with a set starting point and an interval of 5 degrees to obtain a rotation result.
[0089] In this embodiment, the rotation result refers to the result formed after the abnormal trajectory is rotated with a set starting point and an interval of 5 degrees.
[0090] S183: Calculate the minimum path value of the rotation result and the processing result using the DTW algorithm.
[0091] In this embodiment, the minimum path value is the minimum value of each type of abnormal trajectory calculated using the DTW algorithm.
[0092] S190: Determine the abnormality type to which the grouping result belongs according to the minimum path value.
[0093] In this embodiment, the types of abnormal trajectories corresponding to all the minimum path values are determined.
[0094] By calculating artificially generated abnormal trajectories of different types, lengths, and rotation angles, the minimum value of the calculation results of each abnormal trajectory is taken, and finally the minimum value is taken again. The abnormal trajectory type to which the final minimum value belongs is the judgment result of the trajectory.
[0095] There are six types of S-shaped abnormal trajectories, including two directions and three lengths; ten types of O-shaped abnormal trajectories, including two directions and five lengths; and ten types of irregular abnormal trajectories. The DTW algorithm is used to calculate the trajectory to be determined against each of these trajectories. Each trajectory is rotated from its starting point at intervals of 5 degrees. The trajectory to be determined is compared with the minimum value calculated by the DTW algorithm for each type of abnormal trajectory. If the final minimum value belongs to an S-shaped abnormal trajectory, it is determined to be an S-shaped abnormal trajectory; if the final minimum value belongs to an O-shaped abnormal trajectory, it is determined to be an O-shaped abnormal trajectory; if the final minimum value belongs to an irregular abnormal trajectory, it is determined to be an irregular abnormal trajectory.
[0096] Based on the acquired ship AIS track data, anomaly detection is performed on the massive track data. Abnormal ship tracks are simply classified, and three typical abnormal ship tracks are summarized. The motion angle of the continuous ship track points is calculated, and track points with large turns are retained. The track points are then grouped according to the geographical distance of the large turns. The grouped local tracks are analyzed. The DTW algorithm is used to calculate and classify the local tracks and typical abnormal tracks. Abnormal ship tracks are detected based on the characteristics of the abnormal track turning angles, and abnormal tracks are classified and alarmed. Abnormal ship track detection can provide decision-making references for maritime safety supervision, enhance maritime traffic safety, and promote efficient and safe maritime transportation. The DTW algorithm is used to calculate the minimum path value. Because the data points are two-dimensional, the Euclidean distance is used as the distance between points. The manually generated track is rotated during the calculation and then normalized. The track is determined to have the smallest DTW result with the type of abnormal track, which is the abnormal track type.
[0097] For example: First, take the ship AIS trajectory data table as an example to illustrate the abnormal ship trajectory detection process. The ship trajectory AIS data is shown in Table 1.
[0098] Table 1. Ship track AIS data
[0099] Mmsi Time Nav_status Rot Sog 0 Lon Lat Cog 303859000 1635091667 15 128 151 0 120.3997 19.51945 2870 303859000 1635091958 15 128 151 0 120.3794 19.52538 2860 303859000 1635092567 15 128 151 0 120.3362 19.53731 2890 303859000 1635092870 15 128 151 0 120.3153 19.54376 2880 303859000 1635094373 15 128 151 0 120.2101 19.57517 2910 303859000 1635094671 15 128 151 0 120.1901 19.58158 2900 303859000 1635095273 15 128 151 0 120.1492 19.5958 2910 303859000 1635095577 15 128 151 0 120.129 19.60285 2900 303859000 1635096173 15 128 151 0 120.0888 19.61664 2900
[0100] Where MMSI is the ship's maritime communication identification code, time is the AIS signal transmission time, lat is latitude, lon is longitude, sog is speed, and cog is the ship's heading. To read data, the input AIS data is read line by line. Each time, the longitude and latitude of three consecutive track points are read, and the distance between each pair is calculated. Track points that do not meet the conditions for forming a triangle and points where the distance between any two track points is too large are skipped. The angle between the straight line containing the movement direction of each track point and the positive direction of the x-axis (due east) is calculated, and the change in angle (rotation angle) is calculated. Clockwise changes are defined as negative, and counterclockwise changes are defined as positive. And get the index of the large turning angle list (jd1, jd2, ... jdn), jdn represents the serial number of the AIS data line; group the turning angle list, group the trajectory points with too large turning angle distance, if the distance between adjacent large turning angle trajectory points is greater than 44km, then start another group; traverse the grouped turning angle list, and calculate the DTW calculation results of the small group trajectory and different abnormal trajectories after different rotation angles; the same type of abnormal trajectory is converted with different rotation angles and different lengths, and calculated with the trajectory to be judged, and the minimum value is taken, and then compared between different types, and the minimum value is taken; output the abnormal trajectory part, and display the trajectory points of the large turning angle points. The results of the irregular motion trajectory of the ship are obtained as follows Figure 7 shown.
[0101] The above-mentioned abnormal ship trajectory detection method detects abnormal ship trajectories based on the acquired ship AIS trajectory data for a large amount of trajectory data, classifies the abnormal trajectories using the DTW algorithm according to the characteristics contained in the abnormal trajectories, and can perform classification alarms. It is suitable for AIS big data analysis and realizes classification detection of abnormal trajectories. The detection is highly reliable and time-saving.
[0102] Figure 8 FIG. 3 is a schematic block diagram of a ship abnormal trajectory detection device 300 provided by an embodiment of the present invention. Figure 8 As shown, corresponding to the above abnormal ship trajectory detection method, the present invention also provides a ship abnormal trajectory detection device 300. The ship abnormal trajectory detection device 300 includes a unit for executing the above abnormal ship trajectory detection method, and the device can be configured in a server. Figure 8 The ship abnormal trajectory detection device 300 includes a data acquisition unit 301, a latitude and longitude acquisition unit 302, a slope calculation unit 303, an angle difference calculation unit 304, a screening unit 305, a grouping unit 306, an abnormal trajectory determination unit 307, a minimum path value determination unit 308 and a type determination unit 309.
[0103] The data acquisition unit 301 is used to acquire the AIS data of the ship to obtain the AIS data to be detected; the longitude and latitude acquisition unit 302 is used to obtain the longitude and latitude of three consecutive track points that meet the set requirements in the AIS data to be detected; the slope calculation unit 303 is used to calculate the slope of the straight line where two consecutive track points are located in the three consecutive track points to obtain the angle between the two movement directions and the positive direction of the x-axis; the angle difference calculation unit 304 is used to calculate the difference between the angles between the two movement directions and the positive direction of the x-axis to obtain the track angle; the screening unit 305 is used to screen the absolute value of the track angle greater than the set angle threshold and in the navigation state The trajectory point index is stored in a list; a grouping unit 306 is used to group the list to obtain a grouping result; an abnormal trajectory determination unit 307 is used to generate three different types of trajectories with different lengths according to the characteristics of the S-shaped trajectory, the O-shaped trajectory, and the irregular trajectory to obtain an abnormal trajectory; a minimum path value determination unit 308 is used to use the DTW algorithm to normalize the grouping result and the three abnormal trajectories, then rotate the abnormal trajectory at different angles and calculate the minimum path value; a type determination unit 309 is used to determine the abnormal type to which the grouping result belongs based on the minimum path value.
[0104] In one embodiment, the grouping unit 306 is configured to group the list based on distance to obtain a grouping result.
[0105] In one embodiment, if Figure 6 As shown, the minimum path value determining unit 308 includes a normalizing subunit 3081 , a rotating subunit 3082 and a calculating subunit 3083 .
[0106] The normalization subunit 3081 is used to extract the trajectory point coordinates from the first index value to the last index value of a group containing multiple trajectory point indexes, and perform normalization processing to obtain a processing result; the rotation subunit 3082 is used to rotate the abnormal trajectory with a set starting point and an interval of 5 degrees to obtain a rotation result; the calculation subunit 3083 is used to calculate the minimum path value of the rotation result and the processing result using the DTW algorithm.
[0107] In one embodiment, if Figure 7 As shown, the type determination unit 309 is used to determine the types of abnormal trajectories corresponding to all the minimum path values.
[0108] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned ship abnormal trajectory detection device 300 and each unit can refer to the corresponding description in the aforementioned method embodiment. For the convenience and brevity of description, it will not be repeated here.
[0109] The above-mentioned abnormal ship trajectory detection device 300 can be implemented in the form of a computer program. The computer program can be used in Figure 8 Runs on the computer device shown.
[0110] See also Figure 8 , Figure 8 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device 500 may be a server, wherein the server may be an independent server or a server cluster composed of multiple servers.
[0111] See Figure 8 The computer device 500 includes a processor 502 , a memory, and a network interface 505 connected via a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .
[0112] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions, which, when executed, can enable the processor 502 to execute a method for detecting abnormal ship trajectories.
[0113] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500.
[0114] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a method for detecting abnormal ship trajectories.
[0115] The network interface 505 is used to communicate with other devices through the network. Figure 8 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied. The specific computer device 500 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0116] The processor 502 is configured to execute a computer program 5032 stored in the memory to implement the following steps:
[0117] Obtain ship AIS data to obtain AIS data to be detected; obtain the latitude and longitude of three consecutive trajectory points that meet the set requirements in the AIS data to be detected; calculate the slope of the straight line where two consecutive trajectory points in the three consecutive trajectory points are located to obtain the angles between the two movement directions and the positive direction of the x-axis; calculate the difference between the angles between the two movement directions and the positive direction of the x-axis to obtain the trajectory angle; filter the trajectory point indexes whose absolute values of the trajectory angles are greater than the set angle threshold and are in a navigation state, and retain them in a list; group the list to obtain a grouping result; generate three different types of trajectories with different lengths according to the characteristics of S-type trajectories, O-type trajectories and irregular trajectories to obtain abnormal trajectories; use the DTW algorithm to normalize the grouping result and the three abnormal trajectories, then rotate the abnormal trajectory at different angles, and calculate the minimum path value; determine the abnormal type to which the grouping result belongs according to the minimum path value.
[0118] The AIS data to be detected includes time, longitude and latitude, and speed.
[0119] The set requirements include trajectory points that form a triangle condition and trajectory points whose distance between each other exceeds a set distance threshold.
[0120] In one embodiment, when the processor 502 implements the step of grouping the list to obtain a grouping result, the processor 502 specifically implements the following steps:
[0121] The list is grouped based on distance to obtain a grouping result.
[0122] In one embodiment, when the processor 502 implements the steps of normalizing the grouping result and the three abnormal trajectories using the DTW algorithm, rotating the abnormal trajectories at different angles, and calculating the minimum path value, the processor 502 specifically implements the following steps:
[0123] For a group containing multiple trajectory point indexes, the trajectory point coordinates from the first index value to the last index value of the group are taken out and normalized to obtain the processing result; the abnormal trajectory is rotated with a set starting point and an interval of 5 degrees to obtain a rotation result; the DTW algorithm is used to calculate the minimum path value of the rotation result and the processing result.
[0124] In one embodiment, when the processor 502 implements the step of determining the abnormality type to which the grouping result belongs according to the minimum path value, the processor 502 specifically implements the following steps:
[0125] The types of abnormal trajectories corresponding to all the minimum path values are determined.
[0126] It should be understood that in the embodiment of the present application, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0127] Those skilled in the art will appreciate that all or part of the steps in the method of the above-described embodiment can be implemented by instructing the relevant hardware through a computer program. The computer program includes program instructions, which can be stored in a storage medium that is computer-readable. The program instructions are executed by at least one processor in the computer system to implement the steps in the method of the above-described embodiment.
[0128] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein when the computer program is executed by a processor, the processor performs the following steps:
[0129] Obtain ship AIS data to obtain AIS data to be detected; obtain the latitude and longitude of three consecutive trajectory points that meet the set requirements in the AIS data to be detected; calculate the slope of the straight line where two consecutive trajectory points in the three consecutive trajectory points are located to obtain the angles between the two movement directions and the positive direction of the x-axis; calculate the difference between the angles between the two movement directions and the positive direction of the x-axis to obtain the trajectory angle; filter the trajectory point indexes whose absolute values of the trajectory angles are greater than the set angle threshold and are in a navigation state, and retain them in a list; group the list to obtain a grouping result; generate three different types of trajectories with different lengths according to the characteristics of S-type trajectories, O-type trajectories and irregular trajectories to obtain abnormal trajectories; use the DTW algorithm to normalize the grouping result and the three abnormal trajectories, then rotate the abnormal trajectory at different angles, and calculate the minimum path value; determine the abnormal type to which the grouping result belongs according to the minimum path value.
[0130] The AIS data to be detected includes time, longitude and latitude, and speed.
[0131] The set requirements include trajectory points that form a triangle condition and trajectory points whose distance between each other exceeds a set distance threshold.
[0132] In one embodiment, when the processor executes the computer program to implement the step of grouping the list to obtain a grouping result, the processor specifically implements the following steps:
[0133] The list is grouped based on distance to obtain a grouping result.
[0134] In one embodiment, when the processor executes the computer program to implement the steps of normalizing the grouping result and the three abnormal trajectories using the DTW algorithm, rotating the abnormal trajectories at different angles, and calculating the minimum path value, the processor specifically implements the following steps:
[0135] For a group containing multiple trajectory point indexes, the trajectory point coordinates from the first index value to the last index value of the group are taken out and normalized to obtain the processing result; the abnormal trajectory is rotated with a set starting point and an interval of 5 degrees to obtain a rotation result; the DTW algorithm is used to calculate the minimum path value of the rotation result and the processing result.
[0136] In one embodiment, when the processor executes the computer program to implement the step of determining the abnormality type to which the grouping result belongs according to the minimum path value, the processor specifically implements the following steps:
[0137] The types of abnormal trajectories corresponding to all the minimum path values are determined.
[0138] The storage medium may be any computer-readable storage medium that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk.
[0139] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the composition and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0140] In the several embodiments provided herein, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the various units is merely a logical functional division, and actual implementation may employ other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be omitted or not implemented.
[0141] The steps in the methods of the embodiments of the present invention may be adjusted in order, combined, or deleted as needed. The units in the devices of the embodiments of the present invention may be combined, divided, or deleted as needed. Furthermore, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit.
[0142] If this integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the existing technology, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, terminal, or network device, etc.) to execute all or part of the steps of the method described in various embodiments of the present invention.
[0143] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and such modifications or substitutions are intended to be within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.
Claims
1. A method for detecting abnormal ship trajectories, characterized in that: include: Acquire ship AIS data to obtain AIS data to be detected; Obtain the latitude and longitude of three consecutive track points that meet the set requirements in the AIS data to be detected; Calculate the slope of the straight line between two consecutive trajectory points in three consecutive trajectory points to obtain the angle between the two motion directions and the positive direction of the x-axis; Calculate the difference between the angles between the two motion directions and the positive direction of the x-axis to obtain the trajectory angle; Filter the index of the track point whose absolute value of the track angle is greater than the set angle threshold and is in the navigation state, and retain it in the list; Grouping the list to obtain a grouping result; According to the characteristics of S-shaped trajectory, O-shaped trajectory and irregular trajectory, three different types of trajectories with different lengths are generated to obtain abnormal trajectories; The grouping result and the three abnormal trajectories are normalized using the DTW algorithm, the abnormal trajectories are rotated at different angles, and the minimum path value is calculated; The abnormality type to which the grouping result belongs is determined according to the minimum path value.
2. The method for detecting abnormal ship trajectory according to claim 1, characterized in that: The AIS data to be detected includes time, longitude and latitude, and speed.
3. The method for detecting abnormal ship trajectory according to claim 1, characterized in that: The set requirements include trajectory points that form a triangle condition and trajectory points whose distance between each other exceeds a set distance threshold.
4. The method for detecting abnormal ship trajectory according to claim 1, characterized in that: The grouping of the list to obtain a grouping result includes: The list is grouped based on distance to obtain a grouping result.
5. The method for detecting abnormal ship trajectory according to claim 1, characterized in that: The method of using the DTW algorithm to normalize the grouping result and the three abnormal trajectories, rotating the abnormal trajectories at different angles, and calculating the minimum path value includes: For a group containing multiple trajectory point indexes, the trajectory point coordinates from the first index value to the last index value of the group are taken out and normalized to obtain a processing result; Rotate the abnormal trajectory with a set starting point and an interval of 5 degrees to obtain a rotation result; The DTW algorithm is used to calculate the minimum path value of the rotation result and the processing result.
6. The method for detecting abnormal ship trajectory according to claim 1, characterized in that: The determining, according to the minimum path value, the abnormality type to which the grouping result belongs, includes: The types of abnormal trajectories corresponding to all the minimum path values are determined.
7. A device for detecting abnormal ship trajectory, characterized in that: include: A data acquisition unit is used to acquire ship AIS data to obtain AIS data to be detected; A latitude and longitude acquisition unit is used to obtain the latitude and longitude of three consecutive track points that meet the set requirements in the AIS data to be detected; A slope calculation unit is used to calculate the slope of the straight line between two consecutive trajectory points among three consecutive trajectory points, so as to obtain the angles between the two motion directions and the positive direction of the x-axis; An angle difference calculation unit, used to calculate the difference between the angles between the two motion directions and the positive direction of the x-axis to obtain the trajectory angle; a screening unit, configured to screen the indexes of the track points whose absolute values of the track angles are greater than a set angle threshold and which are in a navigation state, and retain them in a list; a grouping unit, configured to group the list to obtain a grouping result; an abnormal trajectory determination unit, configured to generate three different types of trajectories with different lengths according to the characteristics of the S-shaped trajectory, the O-shaped trajectory, and the irregular trajectory, so as to obtain an abnormal trajectory; a minimum path value determining unit, configured to normalize the grouping result and the three abnormal trajectories using a DTW algorithm, rotate the abnormal trajectories at different angles, and calculate a minimum path value; A type determination unit is used to determine the abnormal type to which the grouping result belongs according to the minimum path value.
8. The device for detecting abnormal ship trajectory according to claim 7, characterized in that: The grouping unit is used to group the list based on distance to obtain a grouping result.
9. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 6 when executing the computer program.
10. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.