Port container ship identification method based on AIS big data
By dividing the port into zones and using AIS big data to calculate berthing locations and trajectory characteristics, combined with a ship classification model, the accuracy problem of identifying container ships in the port was solved, the false positive and false negative rates were reduced, and the accuracy of identification and the integrity of the data were improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NINGBO DAHONGYING UNIV
- Filing Date
- 2026-01-06
- Publication Date
- 2026-04-17
AI Technical Summary
In existing technologies, port container ship identification schemes suffer from insufficient accuracy, making it difficult to distinguish between container ships and bulk carriers among cargo ships. Furthermore, AIS data positioning is prone to drift, leading to misjudgments or omissions. Commercial database updates are also lagging and costly, making them unaffordable for small and medium-sized ports.
By dividing the target port into container terminal, buffer and bulk cargo terminal areas, using AIS big data to calculate the berthing position of cargo ships, and combining distance, trajectory point quantity characteristics and ship classification models for screening, and integrating deduplication to improve the accuracy of identification.
It significantly reduced the misclassification rate of non-container ships and the missed classification rate of real container ships, improving the accuracy and data integrity of container ship identification at ports.
Smart Images

Figure CN121880667A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, specifically a port container ship identification method based on AIS big data. Background Technology
[0002] The identification and statistics of container ships in ports are the core foundational data support for shipping market supply and demand analysis, route optimization planning, and port competitiveness assessment. Its accuracy and comprehensiveness directly affect the efficiency of logistics resource allocation, the scientific nature of maritime management decisions, and the formulation of port operation strategies.
[0003] Existing container ship identification technologies suffer from significant technical bottlenecks, making it difficult to meet practical application needs. Traditional identification schemes heavily rely on ship type labeling information provided by commercial databases, but these databases generally suffer from update lags, failing to promptly synchronize information on newly added ships or changes in ship type. Furthermore, the subscription and usage costs of commercial databases are high, making them unaffordable for small and medium-sized ports and research institutions. More importantly, their coverage of small and medium-tonnage container ships is incomplete, leading to statistical inaccuracies and insufficient universality and applicability.
[0004] With the widespread adoption of Automatic Identification Systems (AIS), the industry has begun to explore the use of AIS big data for ship screening. However, key technical challenges remain: AIS data can only filter cargo ship categories by type code, and cannot further distinguish between container ships and sub-categories such as bulk carriers and general cargo ships. Moreover, AIS positioning is affected by factors such as equipment accuracy, electromagnetic interference, and marine environment, and generally suffers from drift, resulting in unreliable ship positioning data. This can easily lead to misidentification of non-container ships as container ships or omission of actually docked container ships, seriously affecting identification accuracy and hindering the effective application of AIS big data in port container ship identification scenarios.
[0005] Therefore, there is an urgent need for a more accurate method to identify container ships in ports using AIS big data. Summary of the Invention
[0006] To address the shortcomings of existing technologies, this invention provides a port container ship identification method based on AIS big data, which solves the problem that the identification of port container ships using AIS big data is not accurate enough in existing technologies.
[0007] To achieve the above objectives, this invention provides a port container ship identification method based on AIS big data. The method includes: setting up a container terminal area, a buffer area, and a bulk cargo terminal area for a target port; acquiring AIS data of cargo ships at the target port and calculating the berthing position of each cargo ship using the cargo ship AIS data; filtering container ships berthed in the container terminal area from the cargo ship AIS data to obtain a first container ship AIS data set; filtering candidate container ships berthed in the buffer area from the cargo ship AIS data to obtain a candidate container ship AIS data set; filtering the candidate container ship AIS data set based on the container terminal area and the buffer area to obtain a second container ship AIS data set; and identifying container ships at the target port using the first container ship AIS data set and the second container ship AIS data set.
[0008] This invention divides the target port into three areas: container terminal, buffer zone, and bulk cargo terminal. Based on AIS big data, it accurately calculates the berthing positions of cargo ships, filters specific container ships within the container terminal area and candidate container ships within the buffer zone, and further refines the candidate ships by combining distance, trajectory point quantity features, and a ship classification model. Finally, it merges and deduplicates the data to obtain the target port's container ship data. This effectively solves the problems of AIS drift interference and cargo ship sub-type identification, significantly reduces the false positive rate of non-container ships and the false negative rate of real container ships, and improves the accuracy of port container ship identification.
[0009] Optionally, obtaining the cargo ship AIS data of the target port includes: obtaining the cargo ship type code and the full AIS data of the target port; and filtering the full AIS data using the cargo ship type code to obtain the cargo ship AIS data of the target port.
[0010] This invention obtains internationally recognized cargo ship type codes and full AIS data of the target port, and then uses the cargo ship type codes as the filtering criteria to remove non-cargo ship data such as passenger ships and fishing boats from the full AIS data, accurately retaining cargo ship-related records, quickly filtering invalid data, avoiding interference from non-cargo ship information with subsequent container ship identification, and reducing data processing redundancy.
[0011] Optionally, the step of calculating the berthing position of each cargo ship using the cargo ship's AIS data includes: calculating the dwell time of the cargo ship using the cargo ship's AIS data; setting an effective dwell time threshold, filtering the dwell time using the effective dwell time threshold to obtain an effective berthing time; and determining the berthing position of each cargo ship based on the effective berthing time.
[0012] This invention calculates the dwell time by analyzing the ship's speed and latitude / longitude changes in AIS data. It then filters out effective berthing times related to loading and unloading using an effective dwell time threshold. Finally, it determines the ship's berthing position based on AIS records within the effective berthing period, eliminating ineffective dwell time data such as temporary avoidance and brief resupply. This avoids interference from ineffective dwell time in berthing position calculation, ensuring a strong correlation between berthing position and the actual operational needs of the ship, and effectively improving the accuracy of cargo ship berthing position calculation.
[0013] Optionally, the step of filtering the candidate container ship AIS data set based on the container terminal area and the buffer area to obtain a second container ship AIS data set includes: obtaining candidate berthing positions in the buffer area based on the candidate container ship AIS data set; calculating the shortest distances between the candidate berthing positions and the container terminal area and the bulk cargo terminal area, respectively; extracting the original trajectory points of each candidate container ship based on the candidate container ship AIS data set; calculating the number of first trajectory points of the candidate container ship in the container terminal area and the number of second trajectory points in the bulk cargo terminal area based on the original trajectory points; and determining the second container ship AIS data set based on the shortest distances, the number of first trajectory points, and the number of second trajectory points.
[0014] This invention obtains candidate berthing locations in the buffer zone from the candidate container ship AIS data set, calculates the shortest distance to the two types of terminals, extracts the original trajectory points, and counts the number of trajectory points of candidate ships in the two types of terminal areas. Finally, it combines the distance and trajectory point count features to screen candidate ships, accurately captures the spatial correlation between candidate ships and target areas, effectively counteracts AIS drift interference, avoids misjudging non-container ships as candidate objects, and significantly improves the accuracy of screening candidate container ships in the buffer zone.
[0015] Optionally, calculating the number of first trajectory points of the candidate container ships in the container terminal area and the number of second trajectory points in the bulk cargo terminal area based on the original trajectory points includes: smoothing the original trajectory points using a moving average method to generate candidate container ship trajectory lines; taking points on the candidate container ship trajectory lines at predetermined distance intervals to obtain candidate container ship trajectory points; extracting the number of first trajectory points in the container terminal area from the candidate container ship trajectory points; and extracting the number of second trajectory points in the bulk cargo terminal area from the candidate container ship trajectory points.
[0016] This invention first smooths the original trajectory points using a moving average method to eliminate AIS drift noise and generate regular trajectory lines. Then, it takes points at predetermined intervals and finally counts the number of trajectory points in container and bulk cargo terminal areas. This process filters out trajectory data interference, ensures that trajectory points are evenly distributed and closely match the actual navigation paths of ships, avoids statistical deviations caused by noise in the original data or uneven point selection, accurately distinguishes the correlation between candidate ships and the two types of terminals, and improves the reliability of trajectory point counting.
[0017] Optionally, determining the second container ship AIS data set based on the shortest distance, the number of the first trajectory points, and the number of the second trajectory points includes: constructing a ship classification model; classifying the candidate container ships using the ship classification model based on the shortest distance, the number of the first trajectory points, and the number of the second trajectory points; and determining the second container ship AIS data set based on the classification results.
[0018] This invention first constructs a ship classification model, then uses the shortest distance of candidate container ships and the number of trajectory points in the two types of terminal areas as features input to the model for classification. Finally, based on the classification results, a second container ship AIS data set is selected. Relying on the model's ability to learn multi-dimensional features, it accurately captures the spatial and trajectory features of container ships, avoids the subjective bias of manual selection, effectively filters out misjudgments caused by AIS drift, and significantly improves the accuracy of candidate ship classification within the buffer area.
[0019] Optionally, constructing the ship classification model includes: setting cross-entropy loss as the initial loss function; setting a comprehensive constraint term and adding the comprehensive constraint term to the initial loss function to obtain an optimized loss function; and constructing the ship classification model based on the optimized loss function.
[0020] This invention adapts the binary classification task by setting the cross-entropy loss as the initial loss function, and then adds a comprehensive constraint term combining the distance threshold and the trajectory point number threshold to form an optimized loss function. Based on this, a ship classification model is constructed. This allows the model to learn basic classification rules while being constrained by business features such as distance and trajectory point number, avoiding prediction bias caused by AIS drift, strengthening the penalty for misclassification scenarios of non-container ships, and improving the performance of the ship classification model.
[0021] Optionally, setting the comprehensive constraint term includes: obtaining a distance threshold and a trajectory point number threshold; and constructing a comprehensive constraint term using the distance threshold and the trajectory point number threshold.
[0022] This invention improves the accuracy and reliability of the ship classification model in determining candidate container ships by obtaining distance thresholds and trajectory point number thresholds, and constructing comprehensive constraint terms using these thresholds.
[0023] Optionally, the step of identifying container ships at the target port using the first container ship AIS data set and the second container ship AIS data set includes: fusing the first container ship AIS data set and the second container ship AIS data set to obtain a fused container ship AIS data set; and performing deduplication processing on the fused container ship AIS data set to obtain container ship data at the target port.
[0024] This invention obtains the target port container ship data by fusing the first container ship AIS data set and the second container ship AIS data set, and then deduplicating the fused data. This supplements the missed ships in the buffer area, while eliminating redundant and duplicate information to avoid data overlap or omission, thus effectively improving the completeness and accuracy of the target port container ship data. Attached Figure Description
[0025] Figure 1 This is a flowchart of a port container ship identification method based on AIS big data, according to an embodiment of the present invention. Detailed Implementation
[0026] Specific embodiments of the present invention will now be described in detail. It should be noted that the embodiments described herein are for illustrative purposes only and are not intended to limit the invention. In the following description, numerous specific details are set forth in order to provide a thorough understanding of the invention. However, it will be apparent to those skilled in the art that these specific details are not necessary to practice the invention. In other instances, well-known circuits, software, or methods have not been specifically described to avoid obscuring the invention.
[0027] Throughout this specification, references to "an embodiment," "an embodiment," "an example," or "an example" mean that a particular feature, structure, or characteristic described in connection with that embodiment or example is included in at least one embodiment of the invention. Therefore, the phrases "in an embodiment," "in an embodiment," "an example," or "an example" appearing in various places throughout the specification do not necessarily refer to the same embodiment or example. Furthermore, specific features, structures, or characteristics can be combined in one or more embodiments or examples in any suitable combination and / or sub-combination. Moreover, those skilled in the art will understand that the illustrations provided herein are for illustrative purposes and are not necessarily drawn to scale.
[0028] To address the problems in the prior art, in an alternative implementation, such as Figure 1 The method for identifying container ships in ports based on AIS big data, as shown, includes the following steps: Step S1: Set up container terminal area, buffer area, and bulk cargo terminal area for the target port.
[0029] In this embodiment, when setting up container terminal area, bulk cargo terminal area, and buffer area for the target port, the container terminal area is first defined as the core area covering container loading and unloading facilities based on the actual geographical layout and terminal type of the port. It is intentionally set to be a relatively small area to ensure that the ships berthed here are likely to be container ships. The bulk cargo terminal area is defined according to the actual location of the bulk cargo terminal and can contain multiple discrete sub-areas to cover the operation points of all non-container cargo ships. The buffer area is set to extend outward from the boundary of the container terminal area to form a buffer area. The outward extension distance can be determined by combining the historical AIS data offset of the target port or by experience. It does not need to be too accurate, only a general range is needed to accommodate the positioning uncertainty caused by AIS data drift and to provide a fault tolerance mechanism when the container terminal and bulk cargo terminal areas are close to each other to avoid misclassification. Close proximity refers to the distance where AIS drift makes it impossible to distinguish the true position of the ship, making it difficult to determine the ship type.
[0030] Step S2: Obtain the AIS data of the cargo ships at the target port, and use the AIS data to calculate the berthing position of each cargo ship.
[0031] The acquisition of cargo ship AIS data at the target port specifically includes the following sub-steps: Step S201: Obtain the full AIS data of the cargo ship type code and the target port.
[0032] In this embodiment, the full AIS data of the target port refers to all unfiltered raw AIS data from the AIS big data dataset. The ship type coding system established by the International Maritime Organization (IMO) is used to determine the standard basis for cargo ship type codes. The range of representative cargo ship type codes is selected, and a cargo ship type code lookup table is established for later use. Then, the full AIS data of the target port is acquired. The data source is the target port's Vessel Traffic Service (VTS) system. The data time range must cover at least one complete port operation cycle, and the data fields must completely include the ship's unique identifier (MMSI code), timestamp, latitude and longitude coordinates, ship speed, heading, and ship type code. After acquisition, the full AIS data is preliminarily cleaned to remove invalid data with missing timestamps, latitude and longitude coordinates exceeding the target port's geographical boundaries (defined by the port's official geographical coordinate range), or abnormal ship speed and heading fields (such as negative ship speed). This yields the target port's full AIS basic data in a uniform format.
[0033] Step S202: Use the cargo ship type code to filter the full AIS data to obtain the cargo ship AIS data of the target port.
[0034] In this embodiment, a field matching and filtering process is performed using a cargo ship type code lookup table. The ship type code field in the full AIS data is used as the verification basis. Each AIS record is checked to see if its ship type code belongs to the target range in the cargo ship type code lookup table. If it does, the record is retained. If it does not belong or the code field is empty or ambiguous (such as displaying "Unknown", "0" or other invalid numbers), it is marked as non-cargo ship data and removed from the full data. After filtering, the retained records can be further verified by randomly sampling a portion of the filtered data and manually checking the consistency between the ship type code and the actual ship type to ensure that no non-cargo ship data is mixed in. The final target port cargo ship AIS data must retain complete core fields, such as ship MMSI code, timestamp, latitude and longitude, ship speed, and heading.
[0035] The calculation of the berthing position of each cargo ship using the cargo ship's AIS data specifically includes the following sub-steps: Step S211: Calculate the cargo ship's dwell time using the cargo ship's AIS data.
[0036] In this embodiment, the AIS data of cargo ships at the target port are first grouped according to the unique identifier of the ship to ensure that all AIS records of the same cargo ship are grouped together, avoiding confusion between data of different ships. Then, the AIS records in each group are sorted in ascending order by timestamp to form the time series trajectory data of the cargo ship, which facilitates the analysis of its motion status in chronological order. Subsequently, the criteria for determining the stationary state are set: the ship speed in the AIS data is less than 0.5 knots (the ship is basically stationary or moving slowly, excluding normal navigation state) as the core criterion. At the same time, the latitude and longitude changes are combined for auxiliary verification. The latitude and longitude difference between two adjacent AIS records is calculated. If the actual distance corresponding to the difference is less than 50 meters (a reasonable threshold set based on the AIS drift error statistics to avoid misjudging movement due to drift), then the ship is further confirmed to be in a stationary state. Based on this condition, the cargo ship trajectory is analyzed segment by segment: starting from the first record after sorting, if multiple consecutive records meet the criteria for stopping status, the timestamp of the first record that meets the criteria is recorded as the start time of the stop, and the timestamp of the last record that meets the criteria is recorded as the end time of the stop. The duration of the stop is calculated using the end time and start time of the stop. If there are a few records that do not meet the criteria between two adjacent records that meet the stop conditions (e.g., 1-2 records with a ship speed slightly higher than 0.5 knots but a latitude and longitude change of less than 50 meters), it is determined to be a short-term fluctuation in AIS data, and they are still combined into the same stop period for calculation. If the interval between two groups of records that meet the stop conditions exceeds 30 minutes and the latitude and longitude change is greater than 100 meters, it is determined to be two independent stops, and the duration is calculated separately. Finally, the duration of each stop period for each cargo ship is calculated one by one, forming a cargo ship stop information table containing MMSI code, stop start time, stop end time, stop duration, and average latitude and longitude within the stop period.
[0037] Step S221: Set an effective stay duration threshold, and use the effective stay duration threshold to filter the stay duration to obtain the effective berthing time.
[0038] In this embodiment, industry benchmark time data for loading and unloading cargo ships at ports is first obtained. Specifically, the minimum loading and unloading time standards for general cargo ships published by the International Association of Ports and Harbors (IAPH) are used to clarify the minimum reasonable loading and unloading time range for different types of cargo ships (container ships and bulk carriers). The minimum loading and unloading time for container ships is usually 1.5-2 hours (including berthing, mooring, and basic loading and unloading processes), while the minimum loading and unloading time for bulk carriers (loaded with coal, ore, etc.) is usually 2-2.5 hours. To avoid missing the effective berthing time threshold due to occasional small-batch loading and unloading or brief equipment adjustments, the lower limit intersection of the minimum loading and unloading time for the two types of cargo ships is taken, and the effective dwell time threshold is set to 1.5 hours. This value covers the minimum loading and unloading requirements of container ships and can also help exclude short-term non-loading and unloading stops of bulk carriers by using subsequent berthing positions. Then, the cargo ship berthing information table calculated earlier is loaded, and the berthing duration of each berthing record is compared with the 1.5-hour threshold. If the berthing duration is greater than or equal to 1.5 hours, the berthing is determined to be a valid berthing related to loading and unloading, and its corresponding start time and end time are retained as valid berthing time. If the berthing duration is less than 1.5 hours, it is determined to be a non-loading and unloading berthing (such as temporary avoidance, crew embarkation and disembarkation, short-term resupply, etc.), and the berthing record is directly removed. Finally, the list of valid berthing times for each cargo ship is obtained.
[0039] Step S231: Determine the berthing position of each cargo ship based on the effective berthing time.
[0040] In this embodiment, the effective berthing time (including start and end time) of each cargo ship is first associated with its corresponding cargo ship AIS data. The cargo ship AIS records within the effective berthing period are then filtered out. Then, abnormal latitude and longitude points that are obviously outside the target port range in these records are removed. The average value of the remaining effective latitude and longitude is then calculated. Finally, the average value is used as the berthing position of the cargo ship during this effective berthing period, and the berthing position is stored in correspondence with the unique identifier of the cargo ship.
[0041] Step S3: Filter the container ships whose berthing locations are in the container terminal area from the cargo ship AIS data to obtain the first container ship AIS data set.
[0042] In this embodiment, the pre-defined container terminal area is converted into digital boundary data composed of latitude and longitude coordinates. Then, a ray casting method is used to verify whether the berthing position of each container ship (a definite container ship) falls within the container terminal area. The ray casting method involves drawing a virtual ray horizontally to the right from the target point of a cargo ship's berthing position, and counting the number of intersections between the ray and the polygonal boundary of the container terminal area. If the number of intersections is odd, the berthing position is determined to be within the container terminal area; if the number is even or coincides with the boundary, it is determined to be outside the area. Then, based on the judgment results, the MMSI codes of cargo ships whose berthing locations are within the container terminal area are selected to form a target MMSI list. Then, based on this list, all AIS records belonging to these MMSI codes are extracted from the complete cargo ship AIS data, including basic ship information, trajectory data, and valid berthing information. Finally, the integrity of the extracted AIS records is checked, and invalid records with missing fields or logical contradictions (such as a deviation of more than 100 meters between the latitude and longitude of the berthing location and the trajectory point) are removed. After being grouped and sorted by MMSI code, the first container ship AIS data set is obtained.
[0043] Step S4: Select candidate container ships whose berthing location is in the buffer area from the cargo ship AIS data to obtain a set of candidate container ship AIS data.
[0044] In this embodiment, the set buffer area is converted into digital boundary data composed of a set of latitude and longitude coordinates. Similarly, the ray method in step S3 is used to verify whether the berthing position of each candidate container ship (which needs to be further verified to be a container ship) falls within the buffer area. After grouping and sorting by MMSI code, the AIS data set of candidate container ships is obtained.
[0045] Step S5: Based on the container terminal area and the buffer area, filter the candidate container ship AIS data set to obtain a second container ship AIS data set.
[0046] The process of filtering the candidate container ship AIS data sets based on the container terminal area and the buffer area to obtain the second container ship AIS data set specifically includes the following sub-steps: Step S501: Obtain the candidate berthing positions in the buffer area based on the candidate container ship AIS data set.
[0047] In this embodiment, the AIS data set of candidate container ships is first retrieved, and the data within the set is grouped according to the unique identifier of the ship to ensure that all AIS records of the same candidate container ship are grouped together. Then, for each group of data, AIS records that fall within the effective berthing time interval and whose latitude and longitude coordinates are located within the digital boundary of the buffer area are selected to obtain the precise berthing position of the candidate container ship in the buffer area. Finally, the MMSI code of each candidate container ship is associated with and stored with the corresponding berthing position coordinates to form a reference table of candidate container ships and berthing positions in the buffer area, thus obtaining the candidate berthing positions in the buffer area.
[0048] Step S502: Calculate the shortest distance between the candidate berthing location and the container terminal area and the bulk cargo terminal area, respectively.
[0049] In this embodiment, all latitude and longitude coordinates are first converted to a Cartesian coordinate system. Since the port area is small, the influence of the Earth's curvature is ignored, and the error after conversion can be controlled within 0.5 meters, which meets the accuracy requirements for distance calculation. Then, for each candidate berthing position, the point-to-polygon edge shortest distance algorithm is used to calculate two types of distances respectively. Each edge of the polygon in the target area (container terminal area / bulk cargo terminal area) is traversed, and the perpendicular distance from the candidate berthing position to the edge is calculated by the vector projection formula (if the projection point is not between the two endpoints of the edge, the straight-line distance from the position to the closer endpoint is taken). Then, the minimum value is extracted from the distance results of all edges, and it is used as the first shortest distance and the second shortest distance of the candidate berthing position respectively.
[0050] Step S503: Extract the original trajectory points of each candidate container ship based on the candidate container ship AIS data set.
[0051] In this embodiment, the core information of the original trajectory points of each candidate container ship is extracted from the candidate container ship AIS data set. Specifically, this includes the original timestamp and original latitude and longitude coordinates of each record. The extracted trajectory points are then sorted in ascending order according to the original timestamps to form a time series of original trajectory points that can reflect the navigation path of the candidate container ship in the target port waters. The MMSI code of each candidate container ship is then associated with and stored with the corresponding sorted set of original trajectory points to generate a lookup table of candidate container ships, MMSI, and original trajectory points.
[0052] Step S504: Calculate the number of first trajectory points of the candidate container ship in the container terminal area and the number of second trajectory points in the bulk cargo terminal area based on the original trajectory points.
[0053] The specific steps for calculating the number of first trajectory points for the candidate container ship in the container terminal area and the number of second trajectory points in the bulk cargo terminal area based on the original trajectory points include the following sub-steps: Step S50401: The original trajectory points are smoothed using the moving average method to generate candidate container ship trajectory lines.
[0054] In this embodiment, a moving average method is used to process the latitude and longitude data of the original trajectory points to eliminate noise interference caused by AIS positioning drift. Based on the typical sampling frequency of AIS data (1 to 5 minutes per line), the sliding window size is determined to be three consecutive trajectory points. The processing rules for boundary points are also clearly defined: the first trajectory point directly retains its original latitude and longitude data; the second trajectory point uses the latitude and longitude data of the previous two consecutive trajectory points to calculate the average; and the standard moving average operation is performed starting from the third trajectory point. The processing proceeds sequentially in chronological order. For the current trajectory point, its latitude and longitude data with the two preceding adjacent trajectory points are taken, and the arithmetic mean of the longitude and latitude is calculated to obtain the smoothed trajectory point at that location. After all original trajectory points have been smoothed, all smoothed trajectory points are connected sequentially according to their timestamps to form a continuous and smooth polyline. This polyline is the trajectory line of the candidate container ship.
[0055] Step S50402: Take points on the candidate container ship trajectory line at predetermined distance intervals to obtain candidate container ship trajectory points.
[0056] In this embodiment, the distance interval is determined based on the AIS drift error and accuracy requirements of the target port, typically set to 10 meters. This avoids losing crucial trajectory turning information due to excessively large intervals, while also preventing redundant trajectory points and increased computational load due to excessively small intervals. Then, the starting point of the trajectory line (i.e., the first smooth trajectory point of the ship entering the target port waters) is taken as the initial position, and the trajectory line is progressively advanced along its zigzag extension direction: First, the distance from the initial position to the end point of the first zigzag segment of the trajectory line is calculated. If this distance is greater than or equal to 10 meters, a point is marked as a candidate container ship trajectory point at a location where 10 meters have been accumulated along the zigzag segment direction from the initial position. If this distance is less than 10 meters, the end point of the zigzag segment is taken as a temporary point, and the distance of the next zigzag segment is calculated from the temporary point. When the accumulated distance reaches 10 meters, the trajectory point is marked. This process is repeated segment by segment until the entire trajectory line is traversed. If the remaining distance at the end of the trajectory line is less than 10 meters, the end point of the trajectory line is directly used as the last candidate container ship trajectory point to ensure that the trajectory points completely cover the ship's navigation path. Finally, the MMSI code of each candidate container ship is associated with all the corresponding candidate container ship trajectory points and stored to form an association list of candidate container ships, MMSI, and trajectory points.
[0057] Step S50403: Extract the first number of trajectory points in the container terminal area from the candidate container ship trajectory points.
[0058] In this embodiment, a virtual ray is drawn horizontally to the right, starting from the latitude and longitude coordinates of a single trajectory point among the candidate container ship trajectory points. The number of intersections between this ray and the polygon boundary of the container terminal area is counted. If the number of intersections is odd, the trajectory point is determined to be within the container terminal area. Subsequently, for each candidate container ship, the above judgment is performed on all its trajectory points one by one. For each trajectory point determined to be within the container terminal area, the count variable corresponding to the ship is incremented by 1. After all trajectory points of the ship have been judged, the final value of the count variable is the first number of trajectory points of the candidate container ship within the container terminal area.
[0059] Step S50404: Extract the number of second trajectory points for the bulk cargo terminal area from the candidate container ship trajectory points.
[0060] In this embodiment, the latitude and longitude coordinates of a single trajectory point among the candidate container ship trajectory points are used as the starting point, and a virtual ray is drawn in the horizontal right direction. The number of intersections between the ray and the polygon boundary of the bulk cargo terminal area is counted. If the number of intersections is odd, the trajectory point is determined to be within the bulk cargo terminal area. Then, for each candidate container ship, the above judgment is performed on all its trajectory points one by one to obtain the second number of trajectory points of the candidate container ship in the bulk cargo terminal area.
[0061] Step S505: Determine the second container ship AIS data set based on the shortest distance, the number of the first trajectory points, and the number of the second trajectory points.
[0062] The determination of the second container ship AIS data set based on the shortest distance, the number of the first trajectory points, and the number of the second trajectory points specifically includes the following sub-steps: Step S50501: Construct a ship classification model.
[0063] The construction of the ship classification model includes the following sub-steps: Step S5050101: Set the cross-entropy loss as the initial loss function.
[0064] The initial loss function satisfies the following formula: in, The initial loss function is... For the sample size, For the first One sample is a ship tag. Indicates container ship, Indicates non-container ships. For the first The probability that each sample is predicted to be a container ship.
[0065] Step S5050102: Set comprehensive constraint terms and add them to the initial loss function to obtain the optimized loss function.
[0066] Setting comprehensive constraint terms specifically includes the following sub-steps: Step S505010201: Obtain the distance threshold and the number of trajectory points threshold.
[0067] In this embodiment, multi-ocean-area AIS positioning accuracy research reports published by the International Maritime Organization and major global AIS equipment manufacturers were collected. Simultaneously, drift test data from authoritative shipping institutions on different AIS equipment models in diverse scenarios such as nearshore, ocean-going, and inland waterway environments were integrated to obtain a sample of distance differences between the actual location and the AIS positioning location. Abnormal drift values caused by equipment hardware failure or extreme electromagnetic interference (i.e., samples with distance differences exceeding 200 meters) were removed. The remaining valid data were then sorted by distance difference from smallest to largest, and the 95th percentile was used as the distance threshold. This threshold covers 95% of normal AIS drift scenarios. Regardless of the target port's location in any sea area or the type of AIS equipment used, it can serve as a tolerance boundary for determining whether a ship's positioning deviates from its actual location due to normal drift. This ensures that even with industry-wide AIS drift, the shortest distance from a candidate berthing location to the terminal area will not be misjudged as exceeding a reasonable range due to drift, while effectively filtering out 5% of extreme drift interference.
[0068] The threshold for the number of trajectory points needs to be determined in conjunction with the aforementioned predetermined distance intervals and the setting of the container terminal area. According to the operational needs of the container terminal, the setting of the container terminal area should be expanded outward from the berth or waiting area, and should be based on the same expansion standard. For example, taking the outermost berth or waiting area as an example, if it is expanded by M meters with a distance interval of L meters, then the threshold for the number of trajectory points is the ratio of M to L. That is, the minimum straight-line path that a container ship should theoretically travel to reach the berth or waiting area is at least M meters. According to the calculation method of the number of trajectory points, the theoretical minimum number of trajectory points to be generated can be obtained as M divided by L. When the container ship does not travel in a straight line, or the AIS signal drifts, the number of trajectory points generated will definitely be greater than M divided by L. In order to cope with the positioning error in extreme scenarios in AIS data, the value can be appropriately reduced from the calculation result of M divided by L to obtain the threshold for the number of trajectory points.
[0069] Step S505010202: Construct a comprehensive constraint term using the distance threshold and the number of trajectory points threshold.
[0070] The comprehensive constraint term satisfies the following formula: in, For distance constraint terms, For the sample size, For indicator functions, For the first The second shortest distance for each sample Distance threshold For the first The probability that each sample is predicted to be a non-container ship. For the first The first shortest distance for each sample The threshold for the number of trajectory points. For the first The number of second trajectory points for each sample.
[0071] In the above formula, the current classification is binary, with only two possibilities: either it's a container ship or a non-container ship. If the second shortest distance in the sample (the shortest distance from the candidate container ship's location to the bulk cargo terminal area) is greater than a distance threshold, then it cannot be predicted as a non-container ship. The higher the probability of being predicted as a non-container ship, the greater the penalty. Since the candidate container ship is in the buffer zone, it does not need to be considered separately. In this situation, This indicates that both the first shortest distance (the shortest distance from the candidate container ship location to the container terminal area) and the second shortest distance in the sample are less than the distance threshold. This means that the shortest distance between the container terminal area and the bulk cargo terminal area of the port is less than the limit of the AIS positioning drift error. When the number of second trajectory points in the sample is less than the number of trajectory points threshold, it cannot be predicted as a non-container ship. The greater the probability of being predicted as a non-container ship, the greater the penalty.
[0072] The optimized loss function satisfies the following formula: in, To optimize the loss function, The initial loss function is... To constrain the weights, This is a comprehensive constraint term.
[0073] Step S5050103: Construct a ship classification model based on the optimized loss function.
[0074] In this embodiment, referencing AIS general technical parameters, global port layout characteristics of various types, and the movement patterns of ships entering target areas, sample data covering different scenarios is simulated and generated. The sample data includes the first shortest distance from a ship to the container terminal area, the second shortest distance from a ship to the bulk cargo terminal area, the first number of ship trajectories in the container terminal area, and the second number of ship trajectory points in the bulk cargo terminal area. Each sample contains core features such as the ship's MMSI code, trajectory point latitude and longitude, timestamp, shortest distance to the two types of terminals, and the number of trajectory points in the corresponding area. It also covers typical scenarios such as normal container ship operations, non-container ships drifting into the area, and confusion due to close proximity between the two terminals. Subsequently, senior experts in port scheduling and maritime management were invited to participate. Based on industry experience, a unified labeling standard was established. Container ship samples must meet the following requirements: distance to the container terminal less than or equal to a distance threshold; number of trajectory points in the corresponding area greater than or equal to a trajectory point threshold; and trajectory conforming to operational berthing logic. Non-container ship samples must meet the following requirements: distance to the bulk cargo terminal less than or equal to a distance threshold; or drifting into the container terminal area but the number of trajectory points less than a threshold; and navigation path pointing to a non-container operation area. Experts labeled each simulated sample individually, and after normalization, training and test sets were formed. Finally, binary logistic regression was selected, and the labeled sample features were input into the model. With the goal of optimizing the loss function, the model parameters were iteratively optimized so that the model learned the mapping relationship between distance, number of trajectory points, and ship type, ultimately resulting in the construction of a ship classification model.
[0075] For the The probability of a sample being predicted as a container ship. Calculated using the Sigmoid function: in, It is the first The input feature vector of each sample, It is a weight vector. This is the bias term. It represents the probability that the sample is predicted to be a non-container ship. for .
[0076] Step S50502: Classify the candidate container ships using the ship classification model based on the shortest distance, the number of the first trajectory points, and the number of the second trajectory points.
[0077] In this embodiment, the shortest distance includes the first shortest distance from the candidate container ship to the container terminal area and the second shortest distance from the candidate container ship to the bulk cargo terminal area. The shortest distance, the number of first trajectory points and the number of second trajectory points of each candidate container ship are normalized and then input into the ship classification model to obtain the classification result of each candidate container ship.
[0078] Step S50503: Determine the second container ship AIS data set based on the classification results.
[0079] In this embodiment, the MMSI codes of candidate ships identified as container ships by the ship classification model are extracted as core identifiers. Then, based on these MMSI codes, the second container ship AIS data set is obtained by matching and filtering the MMSI codes from the candidate container ship AIS data set.
[0080] Step S6: Identify the container ships at the target port using the first container ship AIS data set and the second container ship AIS data set.
[0081] The identification of container ships at the target port using the first container ship AIS data set and the second container ship AIS data set specifically includes the following sub-steps: Step S601: Merge the first container ship AIS data set and the second container ship AIS data set to obtain a merged container ship AIS data set.
[0082] In this embodiment, the first container ship AIS data set and the second container ship AIS data set are merged into a complete merged container ship AIS data set.
[0083] Step S602: Perform deduplication on the fused container ship AIS data set to obtain the container ship data of the target port.
[0084] In this embodiment, the MMSI code, the unique identifier of a ship, is used as the core dimension. The fused container ship AIS data set is grouped by MMSI code, and each group is sorted in ascending order by timestamp. Then, in each group, if the time interval between two adjacent records is less than a predetermined value (depending on the statistical requirements, such as multiple stops less than 48 hours are counted once), only the core information of the first record is retained, and subsequent duplicate or redundant records are deleted. At the same time, completely duplicate entries are removed. Finally, all valid records after grouping are summarized to obtain container ship data. Alternatively, according to the principle of single retention of container ship MMSI codes, all container ships with duplicate MMSI codes can be removed, and only single container ship information is retained.
[0085] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be covered within the scope of the claims and specification of the present invention.
Claims
1. A port container ship identification method based on AIS big data, characterized in that, The method includes: Set up container terminal areas, buffer areas, and bulk cargo terminal areas for the target port; Obtain AIS data of cargo ships at the target port, and use the AIS data to calculate the berthing position of each cargo ship; The container ships whose berthing locations are in the container terminal area are selected from the cargo ship AIS data to obtain the first container ship AIS data set; From the cargo ship AIS data, candidate container ships whose berthing locations are in the buffer area are selected to obtain a candidate container ship AIS data set. The second container ship AIS data set is obtained by filtering the candidate container ship AIS data set based on the container terminal area and the buffer area. The container ships at the target port are identified using the first container ship AIS data set and the second container ship AIS data set.
2. The port container ship identification method based on AIS big data according to claim 1, characterized in that, The acquisition of cargo ship AIS data at the target port includes: Obtain full AIS data for cargo ship type codes and target ports; The cargo ship type code is used to filter the full AIS data to obtain the cargo ship AIS data for the target port.
3. The port container ship identification method based on AIS big data according to claim 1, characterized in that, The calculation of the berthing position of each cargo ship using the cargo ship's AIS data includes: The cargo ship's dwell time is calculated using the cargo ship's AIS data; Set an effective stay duration threshold, and use the effective stay duration threshold to filter the stay duration to obtain the effective berthing time; The berthing position of each cargo ship is determined based on the effective berthing time.
4. The port container ship identification method based on AIS big data according to claim 1, characterized in that, The process of filtering the candidate container ship AIS data sets based on the container terminal area and the buffer area to obtain the second container ship AIS data set includes: The candidate berthing locations in the buffer area are obtained based on the candidate container ship AIS data set. Calculate the shortest distances between the candidate berthing locations and the container terminal area and the bulk cargo terminal area, respectively; The original trajectory points of each candidate container ship are extracted based on the candidate container ship AIS data set; Based on the original trajectory points, calculate the number of first trajectory points of the candidate container ship in the container terminal area and the number of second trajectory points in the bulk cargo terminal area; The second container ship AIS data set is determined based on the shortest distance, the number of the first trajectory points, and the number of the second trajectory points.
5. The port container ship identification method based on AIS big data according to claim 4, characterized in that, The step of calculating the number of first trajectory points of the candidate container ship in the container terminal area and the number of second trajectory points in the bulk cargo terminal area based on the original trajectory points includes: The original trajectory points are smoothed using the moving average method to generate candidate container ship trajectory lines; The candidate container ship trajectory points are obtained by taking points at predetermined distance intervals along the candidate container ship trajectory line. Extract the first number of trajectory points in the container terminal area from the candidate container ship trajectory points; Extract the number of second trajectory points for the bulk cargo terminal area from the candidate container ship trajectory points.
6. The port container ship identification method based on AIS big data according to claim 4, characterized in that, The determination of the second container ship AIS data set based on the shortest distance, the number of the first trajectory points, and the number of the second trajectory points includes: Construct a ship classification model; The candidate container ships are classified using the ship classification model based on the shortest distance, the number of the first trajectory points, and the number of the second trajectory points; The second container ship AIS data set was determined based on the results of the classification.
7. The port container ship identification method based on AIS big data according to claim 6, characterized in that, The construction of the ship classification model includes: Set the cross-entropy loss as the initial loss function; Set a comprehensive constraint term, and add the comprehensive constraint term to the initial loss function to obtain the optimized loss function; A ship classification model is constructed based on the optimized loss function.
8. The port container ship identification method based on AIS big data according to claim 7, characterized in that, The set comprehensive constraint items include: Obtain the distance threshold and the number of trajectory points threshold; A comprehensive constraint term is constructed using the distance threshold and the number of trajectory points threshold.
9. The port container ship identification method based on AIS big data according to claim 1, characterized in that, The step of identifying container ships at the target port using the first container ship AIS data set and the second container ship AIS data set includes: The first container ship AIS data set and the second container ship AIS data set are fused to obtain a fused container ship AIS data set. The container ship data for the target port is obtained by deduplicating the fused container ship AIS data set.