A ship avoidance behavior recognition and prediction method and system
Patent Information
- Application Number
- CN202511104604.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-07
- Publication Date
- 2026-08-28
- Estimated Expiration
- 2045-08-07
AI Technical Summary
[0004]为解决传统船舶避台识别方法无法应对复杂的船舶营运环境导致在识别过程中存在的难以准确识别避台行为、易出现误判或漏判等问题,本发明提供了一种船舶避台行为识别与预测方法,能够准确识别船舶在遭遇台风时采取的偏航避台行为和变速避台行为,有效提升了识别准确率与泛化能力,且能够及时掌握船舶的避台操作情况,为灾害应对和运输调度提供决策支持,从而提高海上安全水平
[0033]本发明提供的一种船舶避台行为识别与预测方法,首先采集船舶的AIS轨迹数据并进行预处理,预处理过程能够去除异常值和错误数据,同时防止模型过拟合,有效提升了检测模型的准确性;并根据预处理后的载重吨数据将船舶划分为大型船舶和小型船舶,提升了模型的针对性和识别精度,适应不同类型船舶的行为特点,提高了避台行为识别的有效性;再将船舶避台行为划分为偏航避台行为和变速避台行为;针对偏航避台行为,对于大型船舶采用整体主线拟合法计算垂直距离,能有效捕捉其偏离主航线的显著行为,适用于其航行路径较为稳定的特点;对于小型船舶采用滑动窗口局部拟合法计算偏移量,能够适应其机动性强、路径变化频繁的特性,提高偏航识别的灵敏度;并基于阈值判断是否标记为偏航点,大型船舶的整体主线拟合方法适用于捕捉其较为稳定但显著的偏航行为;小型船舶的局部拟合方法更能适应其灵活多变的航行特点,从而提高了偏航行为识别的准确性,且能够更精准地识别偏航行为,减少误判率;然后基于偏航数据集及MMSI识别码将AIS轨迹数据中偏航的船舶剔除,得到剔除后的未偏航船舶AIS轨迹数据,通过排除偏航干扰后,仅关注未偏航但可能存在变速避台行为的船舶,使变速行为识别更加精准;针对变速避台行为,使用瞬时加速度作为指标来判断变速避台行为,并为每艘船赋予相应的变速行为标签,瞬时加速度能更准确反映船舶在应对台风时的速度变化情况,相较于单纯的航速提供了更加动态的行为描述;通过细致的加速度分析,不仅能够识别出是否存在变速行为,还能够进一步精准区分加速、减速或正常等不同行为模式,增强了对船舶应对台风策略的理解,为精细化管理提供支持;然后利用XGBoost模型分别对偏航和变速数据集进行二分类模型和三分类模型训练,并通过对应的测试集评估模型性能,XGBoost模型因其优秀的处理高维稀疏数据的能力,在快速收敛的同时保证了较高的预测准确率,通过训练集与测试集的合理划分,确保了模型的泛化能力和稳定性,使得最终得到的模型既能在已知数据上表现良好,也能很好地适应未知的新数据;二分类模型能高效识别是否存在偏航避台行为,具有较高的召回率与精确率,三分类模型可进一步细分为加速、减速或无明显变速行为,增强了对船舶应对台风策略的理解;最后使用训练好的偏航和变速识别模型对待检测船舶进行预测,输出包含MMSI码、预测行为类别信息、各类行为概率分布信息以及船舶类型信息的预测结果文件的结果文件,完成船舶避台行为的识别与预测,实现对实时或历史AIS数据中船舶避台行为的自动识别与分类,有效提升了预警效率,同时输出的概率分布信息可用于辅助决策,例如优先关注高概率避台行为的船舶。针对传统识别方法无法应对复杂的船舶运营环境,以及多源数据融合与未知船舶泛化难题,本发明构建了高效的船舶避台行为识别框架,为智能港口管理和船舶安全监控提供了新的技术支持,同时支持对大型与小型船舶的差异化行为预测,提升了在复杂环境下的适应性与智能化水平,为海事管理部门提供了详细的决策支持信息,实现了对船舶避台行为的实时监测与预警,提升了海上安全管理水平。
Smart Images

Figure CN120998066B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of shipping information and intelligent technology, specifically to a method and system for identifying and predicting ship typhoon avoidance behavior. Background Technology
[0002] With the increasing frequency of global climate change and extreme weather events, typhoons pose a severe challenge to maritime transport safety. Ships often take typhoon avoidance maneuvers to mitigate risks when encountering typhoons. This behavior not only affects the safety of the ship itself but also impacts the scheduling efficiency and emergency response capabilities of the entire port and shipping system. Ship typhoon avoidance behaviors mainly fall into two categories: yaw avoidance and speed-change avoidance. Yaw avoidance typically involves a significant deviation from the typhoon's path to avoid it; speed-change avoidance involves adjusting speed by accelerating or decelerating to wait for or quickly traverse the risk area. Identifying and understanding these avoidance behaviors is crucial for constructing disaster scenario response models, optimizing route planning, and improving maritime traffic management.
[0003] However, in practical applications, the lack of clear labels for ship typhoon avoidance behavior and the existence of incomplete and ambiguous data in AIS tracks make it difficult to accurately identify a large number of typhoon avoidance behaviors. Furthermore, due to differences in ship tonnage, route type, and typhoon path, different types of ships exhibit significant differences in their typhoon avoidance strategies, further increasing the complexity of identification. Current identification methods mostly rely on manual rules or trajectory offset thresholds, which are prone to misjudgment or omission when faced with large-scale historical data or complex and diverse typhoon avoidance patterns. How to extract representative behavioral features from limited observational information based on AIS data and achieve accurate differentiation of different typhoon avoidance types has become a key challenge and hot topic in ship typhoon avoidance behavior research. Summary of the Invention
[0004] To address the problems of traditional ship typhoon avoidance identification methods, such as inaccurate identification of typhoon avoidance behavior and susceptibility to misjudgments or omissions, which are unable to cope with the complex operating environment of ships, this invention provides a method for identifying and predicting ship typhoon avoidance behavior. This method can accurately identify yaw and speed-changing typhoon avoidance behaviors adopted by ships when encountering typhoons, effectively improving the identification accuracy and generalization ability. Furthermore, it can promptly grasp the typhoon avoidance operation status of ships, providing decision support for disaster response and transportation scheduling, thereby improving maritime safety. This invention also relates to a ship typhoon avoidance behavior identification and prediction system.
[0005] The technical solution of the present invention is as follows:
[0006] A method for identifying and predicting ship typhoon avoidance behavior, characterized by the following steps:
[0007] Data acquisition and ship classification steps: Collect the ship's AIS trajectory data and preprocess it. The AIS trajectory data includes the ship's latitude and longitude coordinates, MMSI code, speed, timestamp, and deadweight tonnage. Based on the preprocessed deadweight tonnage data, the ship is classified into large ships and small ships.
[0008] The steps for constructing the yaw dataset are as follows: Ship typhoon avoidance behavior is divided into yaw avoidance behavior and variable speed typhoon avoidance behavior. For yaw avoidance behavior of large ships, based on the ship's latitude and longitude coordinates and using the overall principal line fitting method, the vertical distance from each trajectory point of the preprocessed AIS trajectory data to the main line is calculated. The vertical distance is compared with a preset distance threshold, and trajectory points with a vertical distance greater than the preset distance threshold are marked as yaw points of large ships. For yaw avoidance behavior of small ships, based on the ship's latitude and longitude coordinates and using the sliding window local fitting method, the offset of each trajectory point of the small ship is calculated. The offset is compared with a preset offset threshold, and trajectory points with an offset greater than the preset offset threshold are marked as yaw points of small ships. A yaw dataset is constructed based on the yaw points of large ships and small ships.
[0009] Steps for constructing the variable speed dataset: Based on the yaw dataset and MMSI identification code, ships that yaw in the AIS trajectory data are removed to obtain the AIS trajectory data of ships that have not yawed; for variable speed typhoon avoidance behavior, the instantaneous acceleration is calculated based on the speed and timestamp of two adjacent trajectory points in the AIS trajectory data of ships that have not yawed, and the variable speed typhoon avoidance situation of large ships and small ships is determined based on the instantaneous acceleration, and a variable speed behavior label is assigned to each large ship and small ship according to the variable speed typhoon avoidance situation, thereby constructing the variable speed dataset;
[0010] Model construction and training steps: Divide the yaw dataset and the variable speed dataset into training set and test set according to a preset ratio to obtain yaw training set and yaw test set, and variable speed training set and variable speed test set respectively; then input the yaw training set into the XGBoost model for training to obtain a trained binary classification model, and test and analyze it through the yaw test set to obtain the final trained and tested yaw recognition model; and input the variable speed training set into the XGBoost model for training to obtain a trained tri-class classification model, and test and analyze it through the variable speed test set to obtain the final trained and tested variable speed recognition model.
[0011] Ship typhoon avoidance behavior prediction steps: Use the yaw recognition model and speed change recognition model to identify and predict the ship to be detected, and output a prediction result file containing MMSI code, predicted behavior category information, probability distribution information of various behaviors and ship type information to complete the identification and prediction of ship typhoon avoidance behavior.
[0012] Preferably, in the step of constructing the yaw dataset, calculating the offset of each small vessel's trajectory point based on the vessel's latitude and longitude coordinates and using a sliding window local fitting method specifically includes:
[0013] Multiple sliding windows with the same number of trajectory points are set on the ship's navigation trajectory. The midpoint coordinates of the local principal line fitted through the first and last trajectory points in the sliding window are calculated based on the latitude and longitude coordinates of the first and last trajectory points in the sliding window. The curvature value of the sliding window is calculated based on the latitude and longitude coordinates and the midpoint coordinates of three consecutive trajectory points in a certain sliding window and is used as the offset. The offset is then compared with a preset offset threshold. If the offset is greater than the preset offset threshold, the three consecutive trajectory points in the sliding window are marked as the yaw point of the small ship.
[0014] Preferably, in the yaw dataset construction step, the large vessel is a vessel with a deadweight tonnage of 5,000 tons or more, and the preset distance threshold is the maximum of the 95th percentile of the vertical distance between the trajectory points after linear regression fitting of the main route of the large vessel and the 0.009° empirical threshold; the small vessel is a vessel with a deadweight tonnage of less than 5,000 tons, and the preset offset threshold is the 90th percentile of the window curvature value when the sliding window is locally fitted for the small vessel, and the quantile value is calculated based on historical AIS data calibration of the same vessel type and route type; and the preset distance threshold and preset offset threshold are dynamically adjusted according to the typhoon intensity level. For each increase of one level in typhoon intensity, the corresponding threshold is increased by 10%-20% on the original basis to adapt to the characteristics of vessel typhoon avoidance behavior under different risk scenarios.
[0015] Preferably, in the variable speed dataset construction step, assigning variable speed behavior labels to each large and small vessel based on the variable speed avoidance situation specifically involves:
[0016] For large ships, the 95th and 5th percentile values of the overall acceleration distribution of the ship's own AIS trajectory are used as thresholds. If the instantaneous acceleration is greater than the 95th percentile value of the overall acceleration distribution, it is marked as an acceleration avoidance tag; if the instantaneous acceleration is less than the 5th percentile value of the overall acceleration distribution, it is marked as a deceleration avoidance tag; otherwise, it is marked as a normal navigation tag.
[0017] For small vessels, a sensitivity scan is performed on multiple fixed thresholds within the threshold range of [0.001 to 0.01 knots / minute]. The threshold with the most significant behavioral change is identified and marked. If the instantaneous acceleration is greater than the threshold with the most significant behavioral change, it is marked as an acceleration avoidance tag. If the instantaneous acceleration is less than the negative threshold with the most significant behavioral change, it is marked as a deceleration avoidance tag. Otherwise, it is marked as a normal navigation tag.
[0018] Preferably, in the model construction and training steps, before dividing the constructed yaw dataset and variable speed dataset into training set and test set according to a preset ratio, the yaw dataset and variable speed dataset are first subjected to feature processing and encoding, including: deleting data fields that are irrelevant to behavior recognition; converting discrete classification fields into numerical fields using label encoding; standardizing or normalizing continuous numerical fields; and filling missing numerical fields with median or linear interpolation.
[0019] Preferably, in the model building and training steps, after obtaining the trained binary classification model and the tri-class classification model, the performance of the trained binary classification model is evaluated using an evaluation metric using a yaw test set, and the performance of the trained tri-class classification model is evaluated using an evaluation metric using a variable speed test set; the evaluation metric includes accuracy, recall, and F1 score.
[0020] Preferably, in the data acquisition and ship type classification steps, the preprocessing includes converting timestamps to UTC format; deleting duplicate records, invalid fields and outliers; and filling missing values in all fields using the statistical median method or label encoding method.
[0021] A system for recognizing and predicting ship typhoon avoidance behavior, characterized in that it comprises, in sequence, a data acquisition and ship type classification module, a yaw dataset construction module, a variable speed dataset construction module, a model construction and training module, and a ship typhoon avoidance behavior prediction module.
[0022] The data acquisition and ship classification module collects and preprocesses the ship's AIS trajectory data, which includes the ship's latitude and longitude coordinates, MMSI code, speed, timestamp, and deadweight tonnage. Based on the preprocessed deadweight tonnage data, the ship is classified into large and small ships.
[0023] The yaw dataset construction module divides ship typhoon avoidance behavior into yaw avoidance behavior and speed change avoidance behavior. For the yaw avoidance behavior of large ships, based on the ship's latitude and longitude coordinates and using the overall principal line fitting method, the vertical distance from each large ship trajectory point in the preprocessed AIS trajectory data to the main line is calculated. The vertical distance is compared with a preset distance threshold, and trajectory points with a vertical distance greater than the preset distance threshold are marked as large ship yaw points. For the yaw avoidance behavior of small ships, based on the ship's latitude and longitude coordinates and using the sliding window local fitting method, the offset of each small ship trajectory point is calculated. The offset is compared with a preset offset threshold, and trajectory points with an offset greater than the preset offset threshold are marked as small ship yaw points. A yaw dataset is constructed based on the yaw points of large ships and small ships.
[0024] The variable speed dataset construction module removes yawing vessels from the AIS trajectory data based on the yaw dataset and MMSI identification code, obtaining the AIS trajectory data of the vessels that have not yawed. For typhoon avoidance behavior, the module calculates the instantaneous acceleration based on the speed and timestamp of two adjacent trajectory points in the AIS trajectory data of the vessels that have not yawed. Based on the instantaneous acceleration, the module determines the typhoon avoidance situation of large and small vessels, and assigns a variable speed behavior label to each large and small vessel based on the typhoon avoidance situation, thereby constructing the variable speed dataset.
[0025] The model building and training module divides both the yaw dataset and the variable speed dataset into training and testing sets according to a preset ratio, resulting in yaw training and testing sets, and variable speed training and testing sets, respectively. The yaw training set is then input into the XGBoost model for training, resulting in a trained binary classification model, which is then tested and analyzed using the yaw testing set to obtain the final trained and tested yaw recognition model. Similarly, the variable speed training set is input into the XGBoost model for training, resulting in a trained tri-class classification model, which is then tested and analyzed using the variable speed testing set to obtain the final trained and tested variable speed recognition model.
[0026] The vessel typhoon avoidance behavior prediction module uses the yaw recognition model and the speed change recognition model to identify and predict the vessel to be detected, and outputs a prediction result file containing MMSI code, predicted behavior category information, probability distribution information of various behaviors, and vessel type information, thus completing the identification and prediction of vessel typhoon avoidance behavior.
[0027] Preferably, in the yaw dataset construction module, calculating the offset of each small vessel trajectory point based on the vessel's latitude and longitude coordinates and using a sliding window local fitting method specifically includes:
[0028] Multiple sliding windows with the same number of trajectory points are set on the ship's navigation trajectory. The midpoint coordinates of the local principal line fitted through the first and last trajectory points in the sliding window are calculated based on the latitude and longitude coordinates of the first and last trajectory points in the sliding window. The curvature value of the sliding window is calculated based on the latitude and longitude coordinates and the midpoint coordinates of three consecutive trajectory points in a certain sliding window and is used as the offset. The offset is then compared with a preset offset threshold. If the offset is greater than the preset offset threshold, the three consecutive trajectory points in the sliding window are marked as the yaw point of the small ship.
[0029] Preferably, in the model building and training module, before dividing the constructed yaw dataset and variable speed dataset into training and test sets according to a preset ratio, the yaw dataset and variable speed dataset are first subjected to feature processing and encoding, including: deleting data fields unrelated to behavior recognition; converting discrete classification fields into numerical fields using label encoding; standardizing or normalizing continuous numerical fields; and filling missing numerical fields with median or linear interpolation.
[0030] And / or, in the model building and training module, after obtaining the trained binary classification model and the tri-class classification model, the performance of the trained binary classification model is evaluated using the yaw test set through evaluation metrics, and the performance of the trained tri-class classification model is evaluated using the variable speed test set through evaluation metrics; the evaluation metrics include accuracy, recall, and F1 score.
[0031] And / or, in the data acquisition and ship type classification module, the preprocessing includes converting timestamps to UTC format; deleting duplicate records, invalid fields and outliers; and filling missing values in all fields using the statistical median method or label encoding method.
[0032] The technical effects of this invention are as follows:
[0033] This invention provides a method for identifying and predicting ship typhoon avoidance behavior. First, it collects and preprocesses the ship's AIS trajectory data. This preprocessing removes outliers and erroneous data, while preventing model overfitting, effectively improving the accuracy of the detection model. Based on the preprocessed deadweight tonnage data, the ship is categorized into large and small vessels, enhancing the model's relevance and recognition accuracy, adapting to the behavioral characteristics of different ship types, and improving the effectiveness of typhoon avoidance behavior identification. Next, the typhoon avoidance behavior is further divided into yaw avoidance behavior and speed change avoidance behavior. For yaw avoidance behavior, for large ships, the overall principal line fitting method is used to calculate the vertical distance, effectively capturing significant deviations from the main course. The method is designed for vessels with relatively stable navigation paths. For small vessels, a sliding window local fitting method is used to calculate the offset, which can adapt to their high maneuverability and frequent path changes, improving the sensitivity of yaw detection. A threshold is used to determine whether to mark a yaw point. The overall principal line fitting method for large vessels is suitable for capturing their relatively stable but significant yaw behavior. The local fitting method for small vessels is more adaptable to their flexible and changeable navigation characteristics, thereby improving the accuracy of yaw behavior detection and enabling more precise identification of yaw behavior, reducing the false positive rate. Then, based on the yaw dataset and MMSI identification code, yawed vessels are removed from the AIS trajectory data to obtain the AIS trajectory data of the yaw-free vessels. By eliminating yaw interference, the system focuses only on vessels that are not yawed but may be engaging in speed-changing typhoon avoidance behavior, making speed-changing behavior identification more accurate. For speed-changing typhoon avoidance behavior, instantaneous acceleration is used as an indicator to judge this behavior, and each vessel is assigned a corresponding speed-changing behavior label. Instantaneous acceleration more accurately reflects the speed changes of vessels when coping with typhoons, providing a more dynamic behavioral description compared to simple speed. Through detailed acceleration analysis, not only can the existence of speed-changing behavior be identified, but also different behavior modes such as acceleration, deceleration, or normal operation can be further distinguished more precisely, enhancing the understanding of vessels' typhoon response strategies and providing support for refined management. Then, the XGBoost module is used... The XGBoost model was trained on yaw and variable speed datasets using binary and tri-class classification models, respectively. The model performance was evaluated using the corresponding test sets. Due to its excellent ability to handle high-dimensional sparse data, the XGBoost model achieved fast convergence while maintaining high prediction accuracy. The reasonable partitioning of the training and test sets ensured the model's generalization ability and stability, enabling the final model to perform well on known data and adapt well to unknown new data. The binary classification model can efficiently identify whether there is yaw avoidance behavior, with high recall and precision. The tri-class classification model can be further subdivided into acceleration, deceleration, or no obvious variable speed behavior, enhancing the understanding of ships' typhoon response strategies.Finally, the trained yaw and speed change recognition model is used to predict the behavior of the vessel under test. The output file contains the MMSI code, predicted behavior category information, probability distribution information for each behavior type, and vessel type information. This completes the identification and prediction of vessel typhoon avoidance behavior, enabling automatic identification and classification of vessel typhoon avoidance behavior in real-time or historical AIS data, effectively improving early warning efficiency. The output probability distribution information can also be used to assist decision-making, such as prioritizing vessels with a high probability of typhoon avoidance behavior. Addressing the limitations of traditional identification methods in handling complex vessel operating environments and the challenges of multi-source data fusion and generalization to unknown vessels, this invention constructs an efficient vessel typhoon avoidance behavior recognition framework. This provides new technical support for intelligent port management and vessel safety monitoring, while also supporting differentiated behavior prediction for large and small vessels, improving adaptability and intelligence in complex environments. It provides detailed decision support information for maritime management departments, enabling real-time monitoring and early warning of vessel typhoon avoidance behavior, and improving maritime safety management.
[0034] This invention achieves the following overall technical effects by utilizing AIS trajectory data combined with machine learning algorithms (XGBoost model): 1) Enhanced disaster response capabilities: Based on AIS data acquisition and preprocessing technology, and combined with the XGBoost algorithm model to construct binary (yaw) and tri-class (speed change) models, it can accurately identify the typhoon avoidance behaviors (yaw avoidance or speed change avoidance) adopted by ships when encountering typhoons. This allows for timely monitoring of ship typhoon avoidance operations, providing decision support for disaster response and transportation scheduling, thereby improving maritime safety. 2) Enhanced intelligent shipping management: By using the overall mainline fitting method and the sliding window local fitting method to identify yaw behavior for large and small ships respectively, and judging speed change behavior based on instantaneous acceleration changes, it not only achieves automatic identification and classification of ship typhoon avoidance behaviors, but also provides technical support for port operation status assessment, emergency dispatch simulation, and other scenarios, greatly improving the intelligent level of port and shipping management. 3) Vessels are categorized into large and small based on their deadweight tonnage, and different feature extraction strategies are employed (e.g., linear regression fitting of the main route is used for large vessels, while sliding window local fitting is used for small vessels). By adopting multi-strategy feature construction and tonnage-based classification identification methods, the model can adapt to the differences in typhoon avoidance behavior between different types of vessels (small and large vessels), enabling it to better adapt to the behavioral differences of different vessel types and improving recognition accuracy and generalization ability. 4) Implementation without additional data sources: This invention can automatically identify vessel typhoon avoidance behavior based solely on AIS trajectory data without relying on weather radar or ship-to-shore communication. No additional data sources or equipment support are required, reducing implementation costs and technical barriers, and offering broad applicability and deployment flexibility. 5) Promotes the construction of intelligent shipping platforms: The identification results of typhoon avoidance behavior can be used in various scenarios such as port operation status assessment, emergency dispatch simulation, and historical typhoon impact analysis, improving the intelligence level of port and shipping management. 6) Optimizing route planning and transportation efficiency: The results of typhoon avoidance behavior recognition can be integrated with other vessel behavior recognition models (such as refueling behavior recognition, berthing recognition, etc.) to form a more complete vessel behavior recognition system. This facilitates the construction of a more comprehensive intelligent shipping data platform, promotes the development of the shipping industry towards digitalization and intelligence, and improves overall industry efficiency and service quality. In summary, this invention not only improves the accuracy and efficiency of vessel typhoon avoidance behavior recognition but also provides strong support for maritime traffic safety management and the development of intelligent shipping.
[0035] Furthermore, multiple sliding windows with the same number of trajectory points are set on the ship's navigation trajectory. Based on the latitude and longitude coordinates of the first and last trajectory points within the sliding window, and combined with the coordinates of three consecutive trajectory points and the midpoint within the window, the curvature value is calculated as the offset, and compared with a threshold to determine whether it is a deviation point. By calculating the curvature value, the degree of trajectory curvature can be reflected, effectively identifying abnormal turning behavior of small ships caused by typhoon avoidance, effectively improving the ability to capture the flexible maneuvering behavior of small ships, and is suitable for their frequent lane changes and unstable navigation characteristics. Moreover, the sliding window mechanism enhances the robustness of the method, avoids the interference of a single outlier point with the overall judgment, realizes the automatic marking of the deviation behavior of small ships, and effectively improves the efficiency and quality of dataset construction.
[0036] Furthermore, by refining the ship type deadweight tonnage boundaries and dynamic threshold strategies, the ship type classification is made more precise, the quantitative standard of deadweight tonnage is clarified, the ambiguity of ship type definition is eliminated, and the adaptability of the yaw identification algorithm for large / small ships is ensured. By binding the 95th percentile + experience threshold to the largest value and the calibration rules of historical data of the same ship type and route, the fuzzy preset thresholds are transformed into implementable and unavoidable technical features, which strengthens the uniqueness of yaw identification. In addition, the threshold is linked to the typhoon intensity level adjustment, which allows the model to more accurately identify typhoon avoidance behavior in different risk scenarios, improves the adaptability to complex sea conditions, and makes the scenario adaptation dynamic, solving the problem of poor generalization of traditional static thresholds.
[0037] Furthermore, focusing on the differentiated logic of speed change recognition for different ship types, this approach enables large ships to adapt automatically, determining speed changes based on the acceleration quantile value of their own AIS trajectory. This avoids cross-ship type data interference and adapts to the characteristics of large ships with high inertia and stable speed change features, improving the accuracy of acceleration / deceleration for typhoon avoidance recognition. It also refines the approach for smaller ships by using multi-threshold scanning to uncover subtle features of flexible speed changes, solving the problems of missed and false judgments associated with traditional unified thresholds. This is especially effective in accurately capturing typhoon avoidance intentions in complex near-shore navigation sections. Simultaneously, it unifies the ship type-specific judgment rules for the three categories of normal, acceleration, and deceleration, ensuring algorithmic synergy while strengthening the protection of innovative points through differentiated thresholds, making the speed change recognition solution both universal and targeted.
[0038] Furthermore, feature processing and encoding were performed on the yaw and speed change datasets. This included deleting data fields irrelevant to behavior recognition to reduce redundant information and improve model training efficiency; using label encoding to convert discrete classification fields into numerical fields; standardizing or normalizing continuous numerical fields to make features of different dimensions comparable, accelerating model convergence and improving prediction accuracy; and using median padding or linear interpolation to fill in missing numerical fields, ensuring data integrity, avoiding model performance degradation due to missing data, effectively improving data quality and model generalization ability, and enhancing the stability and reliability of recognition results.
[0039] Furthermore, after obtaining the trained binary and ternary classification models, the performance of the trained binary classification model is evaluated using the yaw test set and the performance of the trained ternary classification model is evaluated using the variable speed test set. This helps to comprehensively understand the strengths and weaknesses of the models, guide subsequent model tuning and deployment decisions, and improve the credibility and practicality of the models in real-world applications.
[0040] This invention also relates to a system for identifying and predicting typhoon avoidance behavior of ships. This system corresponds to the aforementioned method for identifying and predicting typhoon avoidance behavior and can be understood as a system that implements the aforementioned method. It includes a data acquisition and ship type classification module, a yaw dataset construction module, a variable speed dataset construction module, a model construction and training module, and a ship typhoon avoidance behavior prediction module, all connected sequentially. These modules work collaboratively, using AIS data acquisition and preprocessing technology combined with binary and tri-classification models built using the XGBoost algorithm. This allows for accurate identification of typhoon avoidance behavior by ships encountering typhoons, enabling timely monitoring of ship typhoon avoidance operations and providing decision support for disaster response and transportation scheduling, thereby improving maritime safety. By utilizing the overall principal line fitting method and the sliding window local fitting method to identify yaw behavior for large and small ships respectively, and judging variable speed behavior based on instantaneous acceleration changes, this system not only achieves automatic identification and classification of ship typhoon avoidance behavior but also provides technical support for port operation status assessment, emergency dispatch simulation, and other scenarios, greatly enhancing the intelligence level of port and shipping management. Attached Figure Description
[0041] Figure 1 This is a flowchart of the ship typhoon avoidance behavior identification and prediction method of the present invention.
[0042] Figure 2 This is a schematic diagram of the yaw trajectory of a large ship according to the present invention.
[0043] Figure 3 This is a schematic diagram of the yaw trajectory of the small boat of the present invention. Detailed Implementation
[0044] The present invention will now be described with reference to the accompanying drawings.
[0045] This invention relates to a method for identifying and predicting ship typhoon avoidance behavior. It is a method based on the XGBoost algorithm and analyzes AIS signal data of ships. Using the XGBoost model, it identifies and models ship typhoon avoidance behavior (including yaw avoidance and speed change avoidance). Based on AIS data, this method identifies typhoon avoidance behavior of ships without explicit labels through feature construction, behavior annotation, and model training. It can automatically identify different typhoon avoidance behaviors of large and small ships without manual annotation. The identification results have high accuracy and practical guiding significance, applicable to port scheduling, shipping safety management, and other scenarios, providing technical support for shipping safety early warning and route planning. The flowchart of this method is shown below. Figure 1 As shown, the steps are as follows:
[0046] I. Data Acquisition and Ship Classification Steps: Collect and preprocess the AIS trajectory data of the ship. The AIS trajectory data includes the ship's latitude and longitude coordinates, MMSI code, speed, timestamp, and deadweight tonnage. Based on the preprocessed deadweight tonnage data, the ship is classified into large ships and small ships.
[0047] Specifically, the AIS trajectory data of the vessel collected in this step is the key AIS trajectory feature data. This involves selecting the most distinctive key features for identifying typhoon avoidance behavior from a large number of AIS features, such as MMSI, timestamp, latitude and longitude, speed (SOG), heading (COG), draft, and vessel tonnage (DWT). Then, the collected AIS trajectory data is preprocessed, including: unifying the time format to UTC (converting timestamp fields from different formats to the international standard UTC time format) and formatting it as a Unix timestamp for subsequent processing; deleting duplicate records and invalid data fields (removing redundant fields such as MMSI codes, record identifiers, etc.). Useless labeling information in modeling (to prevent model overfitting) and outlier data points; and imputation of missing values in all fields using statistical median or label encoding methods. For numeric fields with missing values (such as speed, draft, temperature, etc., which can be represented by numbers), the statistical median method is used to impute missing values (using the median of the field to fill in the missing values); if the field is categorical (such as port name, ship type, etc., which cannot be directly represented by numbers), the label encoding method is used to convert categorical variables into integer labels starting from 0, which is convenient for machine learning models to recognize, so as to convert non-numerical data into a numerical form that the model can understand and prevent missing values from affecting model training. The AIS trajectory data includes the ship's latitude and longitude coordinates (lon,lat), MMSI code, speed (sog), timestamp (system_time), and deadweight tonnage (dwt). Furthermore, due to significant differences in the dynamic response and control strategies of ships of different tonnages during typhoon avoidance, ships are classified into large ships (dwt≥5000) and small ships (dwt<5000) based on the preprocessed deadweight tonnage data. Specifically, abnormal data points are removed as follows: if the number of data points with a speed (SOG) < 3 knots in a ship's AIS trajectory data exceeds 30% of the total data, all data for that ship are removed. For example, in ship A's 100 AIS records, 35 have SOG < 3 knots (35% → removed); if a ship is marked as "yawing" ≥ 10 times in historical data, that ship's data is removed to ensure data quality.
[0048] II. Steps for constructing the yaw dataset: The ship typhoon avoidance behavior is divided into yaw avoidance behavior and speed change avoidance behavior. For the yaw avoidance behavior of large ships, based on the ship's latitude and longitude coordinates and using the overall principal line fitting method, the vertical distance from each large ship's trajectory point in the preprocessed AIS trajectory data to the main line is calculated. The vertical distance is compared with a preset distance threshold, and trajectory points with a vertical distance greater than the preset distance threshold are marked as yaw points of large ships. For the yaw avoidance behavior of small ships, based on the ship's latitude and longitude coordinates and using the sliding window local fitting method, the offset of each small ship's trajectory point is calculated. The offset is compared with a preset offset threshold, and trajectory points with an offset greater than the preset offset threshold are marked as yaw points of small ships. A yaw dataset is constructed based on the yaw points of large ships and small ships.
[0049] In other words, this step, for the yaw recognition task, employs sliding linear fitting and global fitting methods to construct "deviation" labels for small vessels (DWT≤5000) and large vessels (DWT>5000), respectively. Sliding linear fitting performs linear regression on the local trajectory within a fixed window, calculating the deviation of the current point; global fitting fits the main line based on the entire trajectory, calculating the degree of deviation of each point from the main line. If the deviation is greater than a set deviation threshold, it is marked as yaw (value 1); otherwise, it is normal (value 0). This label serves as the target variable for the yaw recognition model.
[0050] Specifically, the behavior of ships avoiding typhoons is first divided into two categories: deviation (ships deviating from their original course to avoid the typhoon) and acceleration (ships adjusting their speed by slowing down or accelerating to cope with the typhoon). For the deviation behavior of large ships, based on the ship's latitude and longitude coordinates, the Global Linear Fit method is used to fit the main course of the ship's entire trajectory in latitude and longitude space using linear regression. The vertical distance d from each trajectory point of the large ship in the AIS trajectory data to the main course is then calculated. i Calculate according to the following formula:
[0051]
[0052] In the above formula, (lon) i ,lat i ) represents the latitude and longitude coordinates of the i-th trajectory point, and a, b, c are the general formula parameters for fitting the main route.
[0053] The larger of the 95th percentile of the vertical distances of all trajectory points and the empirical threshold τ = 0.009 is taken as the final preset distance threshold. For example, suppose the set of vertical distances (in degrees) of a ship is: D = {0.002, 0.003, 0.005, 0.008, 0.015, 0.006, 0.007, 0.012}; first, sort D in ascending order: {0.002, 0.003, 0.005, 0.006, 0.007, 0.008, 0.012, 0.015}; then calculate the position index (8 data points): k = 0.95 × 8 = 7.6 (rounded up to the 8th value). The 8th value is 0.015 → that is, the 95th percentile = 0.015. Then, the 95th percentile value (0.015) is compared with an empirical threshold, and the larger of the two is taken as the final preset distance threshold, as shown in the following formula:
[0054] τ'=max(Percentile 95 (d i ),0.009)
[0055] Since 0.015 is greater than 0.009, the 95th percentile (0.015) is used as the final preset distance threshold. If the vertical distance d from a large ship's trajectory point to the main route... i =0.016, since 0.016 > 0.015, this trajectory point is marked as the yaw point of a large ship; if d i =0.010, since 0.010 < 0.015, it is marked as normal navigation. The yaw trajectory of a large vessel is as follows: Figure 2 As shown.
[0056] To address the yaw behavior of small vessels to avoid typhoons, a series of sliding windows with a fixed number of trajectory points are first set along the vessel's course. Based on the latitude and longitude coordinates of the first and last trajectory points within each sliding window, the midpoint coordinates of the local principal line fitted through these two points are calculated. Then, based on the latitude and longitude coordinates and the midpoint coordinates of three consecutive trajectory points within a sliding window, the curvature value of that sliding window is calculated and used as the offset, according to the following formula:
[0057]
[0058] Where |Δ| is the area of the triangle formed by three consecutive trajectory points (calculated using Heron's formula based on the latitude and longitude coordinates of the three consecutive trajectory points); P i P k P j These are three consecutive trajectory points within the sliding window, and M is the coordinate of the midpoint of the local principal line fitted by the first and last trajectory points.
[0059] The 90th percentile of all window curvature values for the vessel is used as a preset offset threshold. The offset is compared with the preset offset threshold. If the offset is greater than the preset offset threshold, three consecutive trajectory points within the sliding window are marked as yaw points for the small vessel. The yaw trajectory of the small vessel is as follows: Figure 3 As shown in the figure. Finally, a yaw dataset is constructed based on the yaw points of large ships and small ships.
[0060] Furthermore, the preset distance threshold and preset offset threshold can be dynamically adjusted according to the typhoon intensity level. For example, for each increase in typhoon intensity level, the corresponding threshold is increased by 10%-20% on the original basis to adapt to the characteristics of ship typhoon avoidance behavior under different risk scenarios.
[0061] III. Steps for constructing the variable speed dataset: Based on the yaw dataset and MMSI identification code, vessels that yaw in the AIS trajectory data are removed to obtain the AIS trajectory data of vessels that have not yawed. For variable speed typhoon avoidance behavior, the instantaneous acceleration is calculated based on the speed and timestamp of two adjacent trajectory points in the AIS trajectory data of vessels that have not yawed. The variable speed typhoon avoidance situation of large and small vessels is determined based on the instantaneous acceleration, and a variable speed behavior label is assigned to each large and small vessel according to the variable speed typhoon avoidance situation (finally, each trajectory is labeled "normal / deceleration / acceleration"), thereby constructing the variable speed dataset.
[0062] Specifically, firstly, based on the yaw dataset and MMSI identification code, ships yawing in the AIS trajectory data are removed, resulting in the AIS trajectory data of the ships without yaw. Then, for turbulence avoidance behavior, acceleration based on time difference is calculated for the speed SOG time-series data of each ship. That is, the instantaneous acceleration is calculated based on the speed and timestamp of two adjacent trajectory points in the selected AIS trajectory data with speeds within the valid range (3 knots and above), using the following formula:
[0063]
[0064] In the above formula, sog i+1 The speed of the current trajectory point, sog i t represents the speed of the previous trajectory point of the current trajectory point. i+1 t is the timestamp of the previous trajectory point. i This is the timestamp of the previous trajectory point. The time difference is t. i+1 -t i The default time is 5 minutes, i.e., the time window Δt = 5 minutes.
[0065] The typhoon avoidance behavior of large and small vessels is then determined based on instantaneous acceleration. For large vessels, the 95th percentile of all instantaneous accelerations from the vessel's AIS trajectory is used as the acceleration threshold (95% of acceleration values are below this threshold), and the 5th percentile is used as the deceleration threshold (5% of acceleration values are below this threshold). The instantaneous acceleration is then compared with both the acceleration and deceleration thresholds to obtain three categories of labels: Label 0 for normal navigation, Label 1 for accelerating to avoid typhoons, and Label 2 for decelerating to avoid typhoons. In other words, if the instantaneous acceleration of a large vessel is greater than the acceleration threshold, it is marked as "accelerating to avoid typhoons" (Label 1); if the instantaneous acceleration is less than the deceleration threshold, it is marked as "decelerating to avoid typhoons" (Label 2); and otherwise, it is marked as "normal navigation" (Label 0).
[0066] For small vessels, a multi-threshold scanning strategy is used to automatically select the threshold with the best differentiation effect. This involves traversing multiple fixed thresholds (e.g., 0.001–0.01 knots / minute) for sensitivity scanning, selecting the threshold with the most significant changes in acceleration and deceleration behavior for labeling. The final result is a three-category label: 0 for normal navigation, 1 for accelerating to avoid typhoons, and 2 for decelerating to avoid typhoons. For example, within a fixed threshold range (e.g., 0.001–0.01 knots / minute), sensitivity scanning is performed in steps (e.g., 0.001). If the most significant changes in acceleration and deceleration behavior are found at 0.006 knots / minute, then the acceleration threshold is set to 0.006, and the deceleration threshold to -0.006. If the instantaneous acceleration of a small vessel is greater than the acceleration threshold (0.006), the vessel is labeled "accelerating to avoid typhoons" (label 1); if the instantaneous acceleration is less than the deceleration threshold (-0.006), it is labeled "decelerating to avoid typhoons" (label 2). If the instantaneous acceleration falls within the range defined by the acceleration and deceleration thresholds, i.e., within [-0.006, 0.006], it is marked as "normal navigation" (label 0). Finally, each large and small vessel is assigned a speed change behavior label, thus constructing a speed change dataset. The comprehensive ranking of the vessel speed change data is shown in Table 1, which displays the vessel identification number (MMSI), deadweight tonnage, deadweight tonnage class, and number of speed change behaviors for different vessels.
[0067] Table 1
[0068]
[0069] IV. Model Construction and Training Steps: Divide the yaw dataset and the variable speed dataset into training and testing sets according to a preset ratio to obtain yaw training and testing sets, and variable speed training and testing sets, respectively. Then, input the yaw training set into the XGBoost model for training to obtain a trained binary classification model, and test and analyze it through the yaw testing set to obtain the final trained and tested yaw recognition model. Similarly, input the variable speed training set into the XGBoost model for training to obtain a trained tri-class classification model, and test and analyze it through the variable speed testing set to obtain the final trained and tested variable speed recognition model.
[0070] Specifically, before training, the constructed yaw and variable speed datasets are first processed and encoded. This includes deleting data fields irrelevant to behavior recognition (such as the ship static identification field MMSI, original timestamp field, etc.); converting discrete classification fields (such as ship type, route area) into numerical types using label encoding; standardizing or normalizing continuous numerical fields (such as speed SOG, draft); and filling missing numerical fields with median or linear interpolation, and uniformly converting them into single-precision floating-point numbers (float32, also known as 32-bit floating-point numbers) format to ensure the stability and efficiency of model training, as well as the consistency of model input. The yaw dataset (labeled as 0 or 1) and the variable speed dataset (labeled as 0 / 1 / 2) are then divided into training and testing sets in an 8:2 ratio, i.e., 80% training and 20% testing. This results in yaw training and testing sets, as well as variable speed training and testing sets. Stratified sampling is used to ensure that the proportion of various behavior labels in the training and testing sets is consistent with the original dataset. Specifically, the parameter stratify = y is set to ensure a balanced label distribution.
[0071] The yaw training set is then input into the XGBoost model for training, resulting in a trained binary classification model (also known as a yaw model). This model is then tested and analyzed using a yaw test set to obtain the final trained and tested yaw recognition model. Specifically, for the yaw model (binary): ① Set the objective function to 'binary:logistic'; ② Use the XGBoost classifier (XGBClassifier) with the following parameters: number of decision trees n_estimators = 300, learning rate learning_rate = 0.05, maximum tree depth max_depth = 6, and a fixed random seed of 42; ③ Use class weights sample_weight to balance the sample distribution; ④ Fit the training set to train the yaw model (binary classification model).
[0072] The variable speed training set is then input into the XGBoost model for training, resulting in a trained three-class classification model (also known as a variable speed model). This model is then tested and analyzed using a variable speed test set to obtain the final trained and tested variable speed recognition model. Specifically, for the variable speed model (multiclass): ① Set the objective function `objective` to `multi:softprob`, and the number of classes to `num_class = 3`; ② The remaining parameters are the same as above; ③ Use the sample weight function `compute_sample_weight(class_weight = 'balanced')` to obtain balanced sample weights, balancing the weights of different classes within the training set and alleviating class imbalance. In other words, because the sample size for ship typhoon avoidance behavior (especially acceleration / deceleration for typhoon avoidance) is much smaller than normal navigation, an imbalanced data processing technique is used to balance the data distribution. XGBoost weighted training can be used, setting higher weights for minority class samples to enhance the model's focus on minority class behavior. The loss function can also be adjusted to reduce the loss contribution of multi-class samples and strengthen the training effect of minority class samples; ④ Fit the training set to train the variable speed model. After obtaining the trained binary and ternary classification models, the model performance was evaluated on the test sets of the yaw and variable speed models, respectively. Specifically, the performance of the trained binary classification model was evaluated using the yaw test set with evaluation metrics, and the performance of the trained ternary classification model was evaluated using the variable speed test set with evaluation metrics (including accuracy, recall, and F1 score). The model evaluation used the classification report function `classification_report` to output the accuracy, recall, and F1 score for each class. The confusion matrix `confusion_matrix` and heatmap were used to visualize the model's confusion, allowing for a direct observation of the recognition of different categories and analysis of the classification effect.
[0073] V. Ship Typhoon Avoidance Behavior Prediction Steps: The yaw recognition model and variable speed recognition model are used to identify and predict the ships to be detected. The output is a prediction result file containing the MMSI code, predicted behavior category information, probability distribution information for each behavior category, and ship type information. This completes the identification and prediction of ship typhoon avoidance behavior, providing support for subsequent maritime monitoring, typhoon warnings, and path replanning. Specifically, after model training and testing, the dataset to be predicted (AIS data without typhoon avoidance behavior labels) undergoes the same preprocessing and feature construction process, and is input into the trained and tested yaw recognition model (for large ships) and variable speed recognition model (for small ships), respectively. This yields behavior prediction labels and probability outputs. The yaw recognition model outputs a binary classification prediction result (0 or 1), and the variable speed recognition model outputs a three-class classification prediction result (0 / 1 / 2). A classification report and confusion matrix are generated to evaluate the recognition effect. Output formats include:
[0074] MMSI;
[0075] Predict behavioral category information (yaw / change of speed / normal);
[0076] Information on the probability distribution of various behaviors;
[0077] Corresponding model ship type (large / small)
[0078] It should be noted that the model prediction results are used in the code to verify the effectiveness of training, and currently no batch predictions or uncertainty judgments are performed on unlabeled AIS data.
[0079] This invention also relates to a ship typhoon avoidance behavior recognition and prediction system. This system corresponds to the aforementioned ship typhoon avoidance behavior recognition and prediction method, and can be understood as a system that implements the above method. The system includes, in sequence, a data acquisition and ship type classification module, a yaw dataset construction module, a variable speed dataset construction module, a model construction and training module, and a ship typhoon avoidance behavior prediction module. Specifically,
[0080] The data acquisition and ship classification module collects and preprocesses the ship's AIS trajectory data, which includes the ship's latitude and longitude coordinates, MMSI code, speed, timestamp, and deadweight tonnage. Based on the preprocessed deadweight tonnage data, the ship is classified into large and small ships.
[0081] The yaw dataset construction module divides ship typhoon avoidance behavior into yaw avoidance behavior and speed change avoidance behavior. For the yaw avoidance behavior of large ships, based on the ship's latitude and longitude coordinates and using the overall principal line fitting method, the vertical distance from each large ship trajectory point in the preprocessed AIS trajectory data to the main line is calculated. The vertical distance is compared with a preset distance threshold, and trajectory points with a vertical distance greater than the preset distance threshold are marked as large ship yaw points. For the yaw avoidance behavior of small ships, based on the ship's latitude and longitude coordinates and using the sliding window local fitting method, the offset of each small ship trajectory point is calculated. The offset is compared with a preset offset threshold, and trajectory points with an offset greater than the preset offset threshold are marked as small ship yaw points. A yaw dataset is constructed based on the yaw points of large ships and small ships.
[0082] The variable speed dataset construction module removes yawing vessels from the AIS trajectory data based on the yaw dataset and MMSI identification code, obtaining the AIS trajectory data of the vessels that have not yawed. For typhoon avoidance behavior, the module calculates the instantaneous acceleration based on the speed and timestamp of two adjacent trajectory points in the AIS trajectory data of the vessels that have not yawed. Based on the instantaneous acceleration, the module determines the typhoon avoidance situation of large and small vessels, and assigns a variable speed behavior label to each large and small vessel based on the typhoon avoidance situation, thereby constructing the variable speed dataset.
[0083] The model building and training module divides both the yaw dataset and the variable speed dataset into training and testing sets according to a preset ratio, resulting in yaw training and testing sets, and variable speed training and testing sets, respectively. The yaw training set is then input into the XGBoost model for training, resulting in a trained binary classification model, which is then tested and analyzed using the yaw testing set to obtain the final trained and tested yaw recognition model. Similarly, the variable speed training set is input into the XGBoost model for training, resulting in a trained tri-class classification model, which is then tested and analyzed using the variable speed testing set to obtain the final trained and tested variable speed recognition model.
[0084] The vessel typhoon avoidance behavior prediction module uses the yaw recognition model and the speed change recognition model to identify and predict the vessel to be detected, and outputs a prediction result file containing MMSI code, predicted behavior category information, probability distribution information of various behaviors, and vessel type information, thus completing the identification and prediction of vessel typhoon avoidance behavior.
[0085] Preferably, in the yaw dataset construction module, the calculation of the offset of each small vessel trajectory point based on the vessel's latitude and longitude coordinates and using the sliding window local fitting method specifically includes:
[0086] Multiple sliding windows with the same number of trajectory points are set on the ship's navigation trajectory. The midpoint coordinates of the local principal line fitted through the first and last trajectory points in the sliding window are calculated based on the latitude and longitude coordinates of the first and last trajectory points in the sliding window. The curvature value of the sliding window is calculated based on the latitude and longitude coordinates and the midpoint coordinates of three consecutive trajectory points in a certain sliding window and is used as the offset. The offset is then compared with a preset offset threshold. If the offset is greater than the preset offset threshold, the three consecutive trajectory points in the sliding window are marked as the yaw point of the small ship.
[0087] Preferably, in the model building and training module, before dividing the constructed yaw dataset and variable speed dataset into training set and test set according to a preset ratio, the yaw dataset and variable speed dataset are first subjected to feature processing and encoding, including: deleting data fields that are irrelevant to behavior recognition; converting discrete classification fields into numerical fields using label encoding; standardizing or normalizing continuous numerical fields; and filling missing numerical fields with median or linear interpolation.
[0088] Preferably, in the model building and training module, after obtaining the trained binary classification model and the tri-class classification model, the performance of the trained binary classification model is evaluated using the yaw test set and the performance of the trained tri-class classification model is evaluated using the variable speed test set and the evaluation metrics include accuracy, recall and F1 score.
[0089] Preferably, in the data acquisition and ship type classification module, the preprocessing includes converting timestamps to UTC format; deleting duplicate records, invalid fields and outliers; and filling missing values in all fields using the statistical median method or label encoding method.
[0090] This invention provides an objective and scientific method and system for identifying and predicting ship typhoon avoidance behavior. Based on AIS data acquisition and preprocessing technology, and combined with binary and tri-classification models constructed using the XGBoost algorithm, it can accurately identify yaw and speed-changing typhoon avoidance behaviors adopted by ships when encountering typhoons, enabling timely monitoring of ship typhoon avoidance operations and providing decision support for disaster response and transportation scheduling. By fully utilizing AIS and weather data, and combining feature selection strategies and data imbalance processing techniques, an efficient framework for identifying ship typhoon avoidance behavior is constructed, providing new technical support for intelligent port management and ship safety monitoring. By employing the overall principal curve fitting method and the sliding window local fitting method to identify yaw behavior for large and small ships respectively, and judging speed-changing behavior based on instantaneous acceleration changes, it not only achieves automatic identification and classification of ship typhoon avoidance behavior, but also provides technical support for port operation status assessment, emergency dispatch simulation, and other scenarios, greatly improving the intelligence level of port and shipping management.
[0091] It should be noted that the specific embodiments described above enable those skilled in the art to more fully understand the present invention, but do not limit the present invention in any way. Therefore, although the present invention has been described in detail with reference to the accompanying drawings and embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the present invention. In short, all technical solutions and improvements that do not depart from the spirit and scope of the present invention should be covered within the protection scope of the present invention patent.
Claims
1. A method for identifying and predicting ship typhoon avoidance behavior, characterized in that, Includes the following steps: Data acquisition and ship classification steps: Collect the ship's AIS trajectory data and preprocess it. The AIS trajectory data includes the ship's latitude and longitude coordinates, MMSI code, speed, timestamp, and deadweight tonnage. Based on the preprocessed deadweight tonnage data, the ship is classified into large ships and small ships. The steps for constructing the yaw dataset are as follows: Ship typhoon avoidance behavior is divided into yaw avoidance behavior and variable speed typhoon avoidance behavior. For yaw avoidance behavior of large ships, based on the ship's latitude and longitude coordinates and using the overall principal line fitting method, the vertical distance from each trajectory point of the preprocessed AIS trajectory data to the main line is calculated. The vertical distance is compared with a preset distance threshold, and trajectory points with a vertical distance greater than the preset distance threshold are marked as yaw points of large ships. For yaw avoidance behavior of small ships, based on the ship's latitude and longitude coordinates and using the sliding window local fitting method, the offset of each trajectory point of the small ship is calculated. The offset is compared with a preset offset threshold, and trajectory points with an offset greater than the preset offset threshold are marked as yaw points of small ships. A yaw dataset is constructed based on the yaw points of large ships and small ships. Steps for constructing the variable speed dataset: Based on the yaw dataset and MMSI identification code, ships that yaw in the AIS trajectory data are removed to obtain the AIS trajectory data of ships that have not yawed; for variable speed typhoon avoidance behavior, the instantaneous acceleration is calculated based on the speed and timestamp of two adjacent trajectory points in the AIS trajectory data of ships that have not yawed, and the variable speed typhoon avoidance situation of large ships and small ships is determined based on the instantaneous acceleration, and a variable speed behavior label is assigned to each large ship and small ship according to the variable speed typhoon avoidance situation, thereby constructing the variable speed dataset; Model construction and training steps: Divide the yaw dataset and the variable speed dataset into training set and test set according to a preset ratio to obtain yaw training set and yaw test set, and variable speed training set and variable speed test set respectively; then input the yaw training set into the XGBoost model for training to obtain a trained binary classification model, and test and analyze it through the yaw test set to obtain the final trained and tested yaw recognition model; and input the variable speed training set into the XGBoost model for training to obtain a trained tri-class classification model, and test and analyze it through the variable speed test set to obtain the final trained and tested variable speed recognition model. Ship typhoon avoidance behavior prediction steps: Use the yaw recognition model and speed change recognition model to identify and predict the ship to be detected, and output a prediction result file containing MMSI code, predicted behavior category information, probability distribution information of various behaviors and ship type information to complete the identification and prediction of ship typhoon avoidance behavior.
2. The method for identifying and predicting ship typhoon avoidance behavior according to claim 1, characterized in that, In the yaw dataset construction step, the calculation of the offset of each small vessel trajectory point based on the vessel's latitude and longitude coordinates and using the sliding window local fitting method specifically includes: Multiple sliding windows with the same number of trajectory points are set on the ship's navigation trajectory. The midpoint coordinates of the local principal line fitted through the first and last trajectory points in the sliding window are calculated based on the latitude and longitude coordinates of the first and last trajectory points in the sliding window. The curvature value of the sliding window is calculated based on the latitude and longitude coordinates and the midpoint coordinates of three consecutive trajectory points in a certain sliding window and is used as the offset. The offset is then compared with a preset offset threshold. If the offset is greater than the preset offset threshold, the three consecutive trajectory points in the sliding window are marked as the yaw point of the small ship.
3. The method for identifying and predicting ship typhoon avoidance behavior according to claim 2, characterized in that, In the yaw dataset construction step, the large vessel is defined as a vessel with a deadweight tonnage of 5,000 tons or more. The preset distance threshold is the maximum value of the 95th quantile of the vertical distance between the trajectory points after linear regression fitting of the main route of the large vessel and the 0.009° empirical threshold. The small vessel is defined as a vessel with a deadweight tonnage of less than 5,000 tons. The preset offset threshold is the 90th quantile of the window curvature value when the sliding window is locally fitted for the small vessel, and the quantile value is calculated based on historical AIS data calibration of the same vessel type and route type. Furthermore, the preset distance threshold and the preset offset threshold are dynamically adjusted according to the typhoon intensity level. For each increase of one level in typhoon intensity, the corresponding threshold is increased by 10%-20% on the original basis to adapt to the characteristics of vessel typhoon avoidance behavior under different risk scenarios.
4. The method for identifying and predicting ship typhoon avoidance behavior according to any one of claims 1 to 3, characterized in that, In the process of constructing the variable speed dataset, assigning variable speed behavior labels to each large and small vessel based on the variable speed avoidance behavior is specifically as follows: For large ships, the 95th and 5th percentile values of the overall acceleration distribution of the ship's own AIS trajectory are used as thresholds. If the instantaneous acceleration is greater than the 95th percentile value of the overall acceleration distribution, it is marked as an acceleration avoidance tag; if the instantaneous acceleration is less than the 5th percentile value of the overall acceleration distribution, it is marked as a deceleration avoidance tag; otherwise, it is marked as a normal navigation tag. For small vessels, a sensitivity scan is performed on multiple fixed thresholds within the threshold range of [0.001 to 0.01 knots / minute]. The threshold with the most significant behavioral change is identified and marked. If the instantaneous acceleration is greater than the threshold with the most significant behavioral change, it is marked as an acceleration avoidance tag. If the instantaneous acceleration is less than the negative threshold with the most significant behavioral change, it is marked as a deceleration avoidance tag. Otherwise, it is marked as a normal navigation tag.
5. The method for identifying and predicting ship typhoon avoidance behavior according to any one of claims 1 to 3, characterized in that, In the model construction and training steps, before dividing the constructed yaw dataset and variable speed dataset into training and test sets according to a preset ratio, the yaw dataset and variable speed dataset are first subjected to feature processing and encoding, including: deleting data fields that are irrelevant to behavior recognition; converting discrete classification fields into numerical fields using label encoding; standardizing or normalizing continuous numerical fields; and filling missing numerical fields with median or linear interpolation.
6. The method for identifying and predicting ship typhoon avoidance behavior according to claim 5, characterized in that, In the model building and training steps, after obtaining the trained binary classification model and the tri-class classification model, the performance of the trained binary classification model is evaluated using the yaw test set and the performance of the trained tri-class classification model is evaluated using the variable speed test set and the evaluation metrics include accuracy, recall, and F1 score.
7. The method for identifying and predicting ship typhoon avoidance behavior according to any one of claims 1 to 3, characterized in that, In the data acquisition and ship type classification steps, the preprocessing includes converting timestamps to UTC format; deleting duplicate records, invalid fields and outliers; and filling missing values in all fields using the statistical median method or label encoding method.
8. A system for recognizing and predicting ship typhoon avoidance behavior, characterized in that, The system includes, in sequence, a data acquisition and ship type classification module, a yaw dataset construction module, a variable speed dataset construction module, a model building and training module, and a ship typhoon avoidance behavior prediction module. The data acquisition and ship classification module collects and preprocesses the ship's AIS trajectory data, which includes the ship's latitude and longitude coordinates, MMSI code, speed, timestamp, and deadweight tonnage. Based on the preprocessed deadweight tonnage data, the ship is classified into large and small ships. The yaw dataset construction module divides ship typhoon avoidance behavior into yaw avoidance behavior and speed change avoidance behavior. For the yaw avoidance behavior of large ships, based on the ship's latitude and longitude coordinates and using the overall principal line fitting method, the vertical distance from each large ship trajectory point in the preprocessed AIS trajectory data to the main line is calculated. The vertical distance is compared with a preset distance threshold, and trajectory points with a vertical distance greater than the preset distance threshold are marked as large ship yaw points. For the yaw avoidance behavior of small ships, based on the ship's latitude and longitude coordinates and using the sliding window local fitting method, the offset of each small ship trajectory point is calculated. The offset is compared with a preset offset threshold, and trajectory points with an offset greater than the preset offset threshold are marked as small ship yaw points. A yaw dataset is constructed based on the yaw points of large ships and small ships. The variable speed dataset construction module removes yawing vessels from the AIS trajectory data based on the yaw dataset and MMSI identification code, obtaining the AIS trajectory data of the vessels that have not yawed. For typhoon avoidance behavior, the module calculates the instantaneous acceleration based on the speed and timestamp of two adjacent trajectory points in the AIS trajectory data of the vessels that have not yawed. Based on the instantaneous acceleration, the module determines the typhoon avoidance situation of large and small vessels, and assigns a variable speed behavior label to each large and small vessel based on the typhoon avoidance situation, thereby constructing the variable speed dataset. The model building and training module divides both the yaw dataset and the variable speed dataset into training and testing sets according to a preset ratio, resulting in yaw training and testing sets, and variable speed training and testing sets, respectively. The yaw training set is then input into the XGBoost model for training, resulting in a trained binary classification model, which is then tested and analyzed using the yaw testing set to obtain the final trained and tested yaw recognition model. Similarly, the variable speed training set is input into the XGBoost model for training, resulting in a trained tri-class classification model, which is then tested and analyzed using the variable speed testing set to obtain the final trained and tested variable speed recognition model. The vessel typhoon avoidance behavior prediction module uses the yaw recognition model and the speed change recognition model to identify and predict the vessel to be detected, and outputs a prediction result file containing MMSI code, predicted behavior category information, probability distribution information of various behaviors, and vessel type information, thus completing the identification and prediction of vessel typhoon avoidance behavior.
9. The ship typhoon avoidance behavior recognition and prediction system according to claim 8, characterized in that, In the yaw dataset construction module, the offset of each small vessel trajectory point is calculated based on the vessel's latitude and longitude coordinates using a sliding window local fitting method, specifically including: Multiple sliding windows with the same number of trajectory points are set on the ship's navigation trajectory. The midpoint coordinates of the local principal line fitted through the first and last trajectory points in the sliding window are calculated based on the latitude and longitude coordinates of the first and last trajectory points in the sliding window. The curvature value of the sliding window is calculated based on the latitude and longitude coordinates and the midpoint coordinates of three consecutive trajectory points in a certain sliding window and is used as the offset. The offset is then compared with a preset offset threshold. If the offset is greater than the preset offset threshold, the three consecutive trajectory points in the sliding window are marked as the yaw point of the small ship.
10. The ship typhoon avoidance behavior recognition and prediction system according to claim 8 or 9, characterized in that, In the model building and training module, before dividing the constructed yaw dataset and variable speed dataset into training and test sets according to a preset ratio, the yaw dataset and variable speed dataset are first subjected to feature processing and encoding, including: deleting data fields that are irrelevant to behavior recognition; converting discrete classification fields into numerical fields using label encoding; standardizing or normalizing continuous numerical fields; and filling missing numerical fields with median or linear interpolation. And / or, in the model building and training module, after obtaining the trained binary classification model and the tri-class classification model, the performance of the trained binary classification model is evaluated using the yaw test set through evaluation metrics, and the performance of the trained tri-class classification model is evaluated using the variable speed test set through evaluation metrics; the evaluation metrics include accuracy, recall, and F1 score. And / or, in the data acquisition and ship type classification module, the preprocessing includes converting timestamps to UTC format; deleting duplicate records, invalid fields and outliers; and filling missing values in all fields using the statistical median method or label encoding method.