Ship draft detection method based on cell dichotomy
By employing a cell-based binary classification method for ship draft detection, and utilizing the YOLOv8 network and cross-entropy loss function to optimize waterline position selection, combined with a draft scale detection module, the problems of low detection accuracy and insufficient adaptability to complex environments in traditional methods are solved, achieving high-precision and stable draft depth detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHONGNAN TRANSPORT
- Filing Date
- 2026-01-30
- Publication Date
- 2026-05-15
AI Technical Summary
Traditional methods for detecting ship draft are inaccurate and inefficient. Existing automated detection methods are not adaptable to complex environments and are difficult to accurately detect the draft of various types of ships.
A cell-based binary classification method for ship draft detection is adopted. Ship photos are captured using the YOLOv8 network to construct a draft marker detection dataset. The waterline position selection is optimized by cell binary classification and cross-entropy loss function. Combined with the draft scale detection module, multiple sub-tasks are processed in a comprehensive manner to achieve accurate detection.
It improves the accuracy of draft depth detection to the centimeter level, enhances robustness and adaptability in complex environments, and can accurately detect the draft depth of different types of ships, ensuring the safety of ship navigation.
Smart Images

Figure CN122049488A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of shipping surveillance technology and relates to a method for detecting ship draft based on cell binary classification. Background Technology
[0002] In the modern water transport industry, shipping, as a core mode of transportation, undertakes a large number of cargo transfer tasks. Ship draft is a key parameter affecting navigation safety and operational efficiency; accurate measurement of its value is of great significance for ensuring the safe passage of ships in waterways and locks, as well as for the rational allocation of lock resources. With the rapid development of the water transport industry, the number of ships continues to increase, and the flow of traffic through locks is constantly rising, placing more stringent demands on the accuracy, efficiency, and intelligence of ship draft measurement.
[0003] Traditional ship draft inspection relies primarily on manual observation and measurement, which has numerous drawbacks. Firstly, accuracy is difficult to guarantee. Manual readings are affected by subjective factors such as reading habits and differences in eyesight among the inspectors. Furthermore, wear and stains on the draft gauge can easily lead to reading errors, potentially jeopardizing navigational safety. Secondly, manual inspection is extremely inefficient. In ports or locks with high ship traffic, a large number of ships waiting for draft inspection can cause severe congestion and significantly reduce navigation efficiency. While existing automated inspection technologies are gradually emerging, they perform poorly in complex environments. In complex lighting conditions, such as direct sunlight, backlighting, or dim lighting, the image quality acquired by the inspection equipment is affected, making it difficult to accurately identify ship draft marks and waterlines. In adverse weather conditions, such as heavy rain, fog, and strong winds, not only does the image acquisition quality decrease, but the signal transmission and processing of the inspection equipment also interferes, leading to deviations in the inspection results. Moreover, the styles and positions of draft marks vary greatly among different types of ships, as do their own structural features, making it difficult for existing automated inspection systems to adapt and achieve accurate inspection of various types of vessels.
[0004] Current solutions mainly include image detection methods based on convolutional neural networks, such as patent CN117351436A, "A Method for Detecting the Draft of Ships Passing Through Locks in a River Section." This method captures ship images using thermal imaging wide-angle cameras and pan-tilt cameras on both sides of the waterway, obtains ship identification information using AIS equipment, and transmits it to a draft detection platform. The platform uses a convolutional neural network (CNN) to segment the image, fit boundary lines, convert the height, and finally calculate the draft. The principle is to use the powerful image feature extraction capability of CNN to find the freeboard area, and combine camera parameters to convert pixel heights into actual heights to obtain the draft. The advantage of this method is that it can automatically learn ship image features, improving detection accuracy and efficiency, and achieving automated detection with reduced manual intervention. The disadvantage is that it is highly dependent on training data; when the training data is incomplete, the detection accuracy may decrease in special situations or with new types of ships, and complex environments have a significant impact on image quality, challenging the reliability of the detection results. Detection methods based on attention mechanisms and deformable convolutions, such as patent CN116824570A "A Deep Learning-Based Draft Detection Method," involve setting up high-definition cameras on both sides of the monitoring channel to take pictures, and using a convolutional neural network detection model based on attention mechanisms (based on CBAM+YOLOv5) to detect the waterline. The model calculates the draft depth by locating the waterline position and combines this with water level information to determine the ship's draft status. This model introduces attention mechanisms and deformable convolutional layers to focus on features in the waterline region, adapting to the detection of waterlines of different sizes. It employs a PP-OCR framework to improve the accuracy of draft gauge detection and recognition. Its advantages include better focus on key areas, improved detection accuracy and adaptability to different ships, low equipment cost, and high maintainability. However, the model structure is complex, computationally intensive, and requires high-performance hardware. Real-time performance is limited, and it is also susceptible to environmental interference, with unstable detection performance in extreme environments. Taking all factors into consideration, this invention proposes a cell-based binary classification method for ship draft detection. It employs a YOLOv8 network to decompose the draft depth reading process into multiple sub-tasks for parallel processing. The cell-based binary classification waterline detection method reduces computational load and enhances the ability to handle complex environments. Multiple ship image draft marker detection datasets are constructed to train the network, improving adaptability. Reasonable draft depth calculation methods are designed for different types of ships, improving the comprehensiveness and accuracy of detection and better meeting the needs of actual production environments. Summary of the Invention
[0005] This invention provides a cell-based binary classification method for ship draft detection, which solves the problems of low accuracy and poor efficiency of traditional ship draft detection methods, as well as the insufficient adaptability of existing automated detection in complex environments and the difficulty in accurately detecting the draft of various types of ships.
[0006] To solve the above problems, the technical solution adopted by the invention is as follows: A method for detecting ship draft based on cell-based binary classification includes the following steps: Step 1: Capture photos of vessels entering the lock using the vessel capture systems on both sides of the waterway, and then use... YOLOv8 The object detection network processes the input ship hull photo image to obtain the ship name, and queries the ship database based on the ship name to obtain the ship identity information, including the ship type and depth; Step 2: Construct a draft marker detection dataset, using... YOLOv8 The network is trained on this dataset, and utilizes the trained data. YOLOv8 Target detection networks detect and locate draft marker regions; Step 3: Detect the waterline and identify the draft, as detailed below: The output feature map of the draft marking region is divided into columns, and each column is further subdivided into multiple cells. Waterline detection is treated as a binary classification task; let the number of columns be... w The number of cells in each column is h The total number is w×h Image features are X , No. i The classifier used to select the waterline position in the column is The probability formula corresponding to waterline detection is: , It is h dimensional vector, i ∈ [1, w]; The loss function corresponding to waterline detection optimization is: ,in It is the first i Label the column in the correct position. It is cross-entropy loss; Structural loss optimization is used to select the waterline location. When predicting the waterline location, first use... softmax The function yields the probability at different positions. Then through the formula Calculate the waterline position; the structural loss function is...
[0007] in It is the first i The actual position on each column; Step 4: For vessels with identifiable draft dimensions, estimate the draft depth based on the relative positions of the waterline and draft ratio; for vessels with unidentifiable draft dimensions, first convert the pixel height to the actual height, then calculate the difference between the molded depth and the freeboard height to obtain the draft depth. The draft ratio refers to the proportion of the spacing between adjacent scale markings on the vessel's draft mark.
[0008] The principle and advantages of this scheme are as follows: This solution is based on a cell-based binary classification method for ship draft detection. The core principle is to first acquire photos of ships entering the lock using a ship capture system on both sides of the channel, and then... YOLOv8 The powerful image recognition capabilities of the object detection network are used to extract ship name information from hull images, and then query the ship database to obtain ship identification information such as draft depth. Next, a draft marker detection dataset is constructed, and this is applied again... YOLOv8 The network is trained to accurately detect and locate draft marker areas. In the crucial waterline detection and draft scale identification stages, the output feature map of the draft marker area is divided into columns and further subdivided into cells. Waterline detection is transformed into a binary classification task. A classifier calculates the probability that each cell belongs to the waterline location, and then the cross-entropy loss function is used to optimize classifier performance, while structural loss optimizes waterline location selection. Simultaneously, combined with the draft scale detection module, multiple subtasks are processed to achieve accurate draft detection. Finally, based on whether the draft scale can be identified, the ship's draft depth is calculated using appropriate methods.
[0009] Compared to existing technologies, both traditional manual and partially automated detection methods have limitations in terms of accuracy, efficiency, and adaptability to complex environments. This solution employs a cell-based binary classification method for waterline detection, which significantly reduces computational load compared to traditional segmentation tasks. Regarding accuracy, a multi-task learning network simultaneously processes multiple sub-tasks such as draft scale detection and waterline detection, avoiding interference between tasks and enabling more accurate identification of waterlines and draft scales. The draft depth detection accuracy is improved by approximately [percentage missing] compared to existing methods. This method ensures safe navigation of ships by measuring centimeters. Regarding adaptability to complex environments, existing automated detection methods exhibit significant deviations in results under conditions of complex lighting and severe weather. This solution trains the model on diverse datasets, making it more robust and enabling stable and accurate detection even in adverse conditions such as heavy rain and backlighting. Furthermore, this solution constructs datasets for training different types of ships, demonstrating good adaptability to variations in draft markings and structural differences, and achieving accurate detection of various vessels. Existing technologies often struggle to accommodate multiple ship types, making this solution more widely applicable and practical in real-world applications.
[0010] Furthermore, a draft scale detection module is added to step three. This module acquires the category and location information of each pixel in the feature map; for the location on the feature map... (x, y) , Object The branch determines whether it is background, integer marker, or decimal marker. Classification The branch determines the integer label category; let the target category label for each position be... t* , Maskobj = 1 The class label for the integer marker at position is c*, and the regression objective for position is... d*The loss function of the draft scale detection module is:
[0011] in It is the weighted cross-entropy. (WCE) The weights for the loss, background, decimal label, and integer label were set to 0.2, 0.4, and 0.4, respectively. yes UnitBox In IoU loss, Indicates the number of draft scale symbols. Indicates the number of integer tokens. and It is an indicator function.
[0012] In the above scheme, the loss function of the draft scale detection module comprehensively considers three tasks: target classification, integer label classification, and position regression. It uses weighted cross-entropy loss and IoU loss to calculate the loss for each task, and sets weights according to the importance of background, decimal labels, and integer labels. At the same time, it uses normalization and indicator functions to accurately filter the calculation range. While balancing the weights of different tasks, it improves the robustness and accuracy of the model, allowing the model to learn draft scale-related features more effectively and accurately identify the category and position of draft scale elements.
[0013] Furthermore, the complete loss function in step three is: Combining the waterline detection classification loss, waterline structure loss, and draft scale detection module loss allows the model to simultaneously optimize both waterline and draft scale detection tasks, avoiding biases caused by training each task separately and improving overall detection performance. By adjusting the hyperparameter λ, the weight ratio of different losses in the total loss can be flexibly balanced, allowing the model to adapt to diverse detection needs and enhancing generalization ability. This function enables the model to learn ship draft-related features from multiple perspectives, achieving more accurate and stable detection in complex environments and under different ship conditions, reducing detection errors and providing strong support for accurate calculation of ship draft.
[0014] Furthermore, in step four, for vessels with identifiable draft dimensions, the closest dimension to the waterline is set as... Its adjacent scale is water and The relative distance is d , and The relative distance is Draft , The closest scale to the water surface Its adjacent scale, and > ,make sure The result is a positive value. Based on a simple, intuitive principle that conforms to geometric proportions, and utilizing readily available information on the relative distance between the waterline and draft, the draft depth can be calculated quickly and accurately. This calculation method is logically clear and computationally simple, requiring no complex conversions or additional information. The result can be directly derived from the actual condition of the ship's draft markings, improving the efficiency and accuracy of draft depth calculation. This facilitates timely acquisition of draft data during navigation, effectively ensuring the safe operation of the vessel. 。
[0015] Furthermore, in step four, for vessels whose draft cannot be identified, the distance from the waterline to the freeboard is calculated. The formula is in The water boundary line for the ship is represented by pixels. For the freeboard, T Obtain values for the camera reference point. Z For the gimbal's zoom, for Z=1 Double Taking into account the actual camera parameters, the pixel row of the boat-water boundary was determined. freeboard Values obtained from camera reference points T Gimbal zoom Z as well as Z=1 Double In combination, this allows for the accurate conversion of image pixel information into actual physical distance. This formula fully considers the actual conditions during camera shooting, such as the impact of gimbal zoom on the size and position of objects in the image, making the calculation results more consistent with reality. The distance calculated in this way lays the foundation for subsequent accurate draft calculations. In ship draft inspection, even if the draft scale cannot be directly identified, this formula can be used to accurately estimate the draft using images and camera parameters, improving the adaptability and accuracy of draft inspection methods and ensuring smooth ship draft inspection under various complex conditions.
[0016] Furthermore, in step four, for vessels whose draft cannot be identified, the ratio of the actual height to the pixel height is calculated.
[0017] The camera's height above the water surface; calculate the distance from the actual ship's waterline to the freeboard. ; Draft D = C - R, C To accommodate the ship's depth, the camera's height above the water surface was introduced. By using parameters such as [specific parameters], the pixel height in the image is converted into the actual height, establishing an accurate connection between image information and actual physical quantities. Using this conversion, the distance from the actual waterline to the freeboard of a ship can be precisely calculated. R Combined with the ship's shape depth C This allows us to determine a reliable draft. D This calculation process fully considers the complex situations that may be encountered in ship draft detection. Even if the draft scale cannot be directly identified, the draft depth can be accurately estimated by using camera parameters and image pixel information, which improves the applicability and accuracy of the draft detection method and ensures that reliable draft depth data support can be provided for safe ship navigation in different scenarios.
[0018] Furthermore, the vessel capture system includes thermal imaging wide-angle cameras and pan-tilt cameras on both sides of the waterway; the draft marker detection dataset contains images of various types of vessels under different environments, including varying lighting conditions and weather conditions; when querying vessel database information, it also retrieves the vessel's past draft data. The capture system, composed of thermal imaging wide-angle cameras and pan-tilt cameras on both sides of the waterway, can capture vessel images from all directions and multiple perspectives. The thermal imaging wide-angle cameras are not limited by lighting conditions and can still clearly capture the vessel outline in complex lighting environments such as nighttime, direct sunlight, or backlighting, ensuring that no vessel information is missed; the pan-tilt cameras can flexibly adjust the shooting angle to accurately focus on the vessel's draft marker area, acquiring high-definition image details, providing high-quality image data support for subsequent accurate identification of vessel names, detection of draft markers and waterlines, improving the accuracy and reliability of detection; the draft marker detection dataset covers images of various types of vessels under different lighting conditions and weather conditions, greatly enriching the diversity of the data. Different types of vessels have different draft marker styles, positions, and vessel structures, and diverse datasets allow for... YOLOv8 The network learns the characteristics of various ships, enhancing the model's adaptability to different ships; image data from different environments enables the model to adapt to complex and changing shooting conditions. In actual detection, regardless of lighting or weather conditions, it can stably and accurately detect draft marking areas, improving the robustness of the detection system.
[0019] Furthermore, in step four, for vessels whose draft dimensions cannot be identified, camera parameters need to be calibrated when calculating draft depth. The calibration method involves taking a picture of a standard object of known size and comparing the actual size with the image size to calculate calibration parameters. When calculating the draft depth of vessels whose draft dimensions cannot be identified, calibrating camera parameters using a specific calibration method can significantly improve the accuracy of draft depth calculation. In practical use, the ratio of the image size captured by a camera to the actual size of the object is easily affected by various factors, such as lens distortion and changes in shooting distance. This can lead to significant errors when directly calculating draft depth based on the image. Taking a picture of a standard object of known size and comparing the actual size with the image size to calculate calibration parameters can effectively eliminate the interference of these factors.
[0020] For example, before calibration, lens distortion may cause the captured images of the ship's freeboard to be stretched or compressed, resulting in inaccurate freeboard height calculations and consequently affecting draft calculations. After calibration, adjusting the image size according to accurate calibration parameters allows for a more precise determination of the actual distance between the ship's waterline and the freeboard, thus making the draft calculation closer to the true value. Furthermore, calibration enhances the versatility of the detection system. Even with camera replacement or changes in the shooting environment, calibration ensures the accuracy of draft calculations, guaranteeing reliable operation of ship draft detection under various conditions and providing stronger data support for safe navigation. Attached Figure Description
[0021] Figure 1 This is a flowchart of the ship draft detection method based on cell binary classification according to the present invention; Figure 2 A schematic diagram of the network processing for ship name recognition; Figure 3 A schematic diagram of the ship's draft region; Figure 4 A diagram illustrating the cell divisions selected for the waterline position; Figure 5 This is a schematic diagram of a multi-task detection network structure based on YOLOv8; Figure 6 A schematic diagram of the geometric relationship for calculating the draft of a ship; Figure 7 A schematic diagram of image processing for draft correction; Figure 8 This is a schematic diagram of the overall process for detecting the draft of ships passing through the lock at the Silin Hub. Detailed Implementation
[0022] Example 1, as Figures 1 - 8 As shown, a method for detecting ship draft based on cell binary classification includes the following steps: Step 1: Capture photos of vessels entering the lock using the vessel capture systems on both sides of the waterway, and then use... YOLOv8 The object detection network processes the input ship hull photo image to obtain the ship name, and queries the ship database based on the ship name to obtain the ship identity information, including the ship type and depth; Step 2: Construct a draft marker detection dataset, using... YOLOv8 The network is trained on this dataset, and utilizes the trained data. YOLOv8 Target detection networks detect and locate draft marker regions; Step 3: Detect the waterline and identify the draft, as detailed below: The output feature map of the draft marking region is divided into columns, and each column is further subdivided into multiple cells. Waterline detection is treated as a binary classification task; let the number of columns be... w The number of cells in each column is h The total number is w×h Image features are X , No. i The classifier used to select the waterline position in the column is The probability formula corresponding to waterline detection is: It is h dimensional vector, i ∈ [1, w]; The loss function corresponding to waterline detection optimization is: ,in It is the first i Label the column in the correct position. It is cross-entropy loss; Structural loss optimization is used to select the waterline location. When predicting the waterline location, first use... softmax The function yields the probability at different positions. Then through the formula Calculate the waterline position; the structural loss function is...
[0023] ,in It is the first i The actual position on each column express The norm (Manhattan distance) is used to calculate the predicted waterline location. With real location The absolute error constrains the spatial continuity of the waterline; Step 4: For vessels with identifiable draft dimensions, estimate the draft depth based on the relative positions of the waterline and draft ratio; for vessels with unidentifiable draft dimensions, first convert the pixel height to the actual height, then calculate the difference between the molded depth and the freeboard height to obtain the draft depth. The draft ratio refers to the proportion of the spacing between adjacent scale markings on the vessel's draft mark.
[0024] By utilizing deep learning technology, the ship draft detection process is meticulously broken down and specifically addressed. First, images of ships entering the lock are acquired through ship capture systems on both sides of the waterway. Then, using... YOLOv8 The powerful image recognition capabilities of the object detection network are used to extract ship name information from hull images, and then query the ship database to obtain ship identification information such as draft depth. Next, a draft marker detection dataset is constructed, and this is applied again... YOLOv8 The network is trained to accurately detect and locate draft marker areas. In the crucial waterline detection and draft scale identification stages, the output feature map of the draft marker area is divided into columns and further subdivided into cells. Waterline detection is transformed into a binary classification task. A classifier calculates the probability that each cell belongs to the waterline location, and then the cross-entropy loss function is used to optimize classifier performance, while structural loss optimizes waterline location selection. Simultaneously, combined with the draft scale detection module, multiple subtasks are processed to achieve accurate draft detection. Finally, based on whether the draft scale can be identified, the ship's draft depth is calculated using appropriate methods.
[0025] Compared to existing technologies, both traditional manual and partially automated detection methods have limitations in terms of accuracy, efficiency, and adaptability to complex environments. This solution employs a cell-based binary classification method for waterline detection, which significantly reduces computational load compared to traditional segmentation tasks. Regarding accuracy, a multi-task learning network simultaneously processes multiple sub-tasks such as draft scale detection and waterline detection, avoiding interference between tasks and enabling more accurate identification of waterlines and draft scales. The draft depth detection accuracy is improved by approximately [percentage missing] compared to existing methods. This method ensures safe navigation of ships by measuring centimeters. Regarding adaptability to complex environments, existing automated detection methods exhibit significant deviations in results under conditions of complex lighting and severe weather. This solution trains the model on diverse datasets, making it more robust and enabling stable and accurate detection even in adverse conditions such as heavy rain and backlighting. Furthermore, this solution constructs datasets for training different types of ships, demonstrating good adaptability to variations in draft markings and structural differences, and achieving accurate detection of various vessels. Existing technologies often struggle to accommodate multiple ship types, making this solution more widely applicable and practical in real-world applications.
[0026] In step three, a draft scale detection module is added. This module acquires the category and location information of each pixel in the feature map; for the location on the feature map... (x, y) ,Object The branch determines whether it is background, integer marker, or decimal marker. Classification The branch determines the integer label category; let the target category label for each position be... t* , Maskobj = 1 The class label for the integer marker at the location is c* The regression target for the position is d* The loss function of the draft scale detection module is:
[0027] in It is the weighted cross-entropy. (WCE) The weights for the loss, background, decimal label, and integer label were set to 0.2, 0.4, and 0.4, respectively. yes UnitBox In IoU loss, Indicates the number of draft scale symbols. Indicates the number of integer tokens. and It is an indicator function.
[0028] In the above scheme, the loss function of the draft scale detection module comprehensively considers three tasks: target classification, integer label classification, and position regression. It uses weighted cross-entropy loss and IoU loss to calculate the loss for each task, and sets weights according to the importance of background, decimal labels, and integer labels. At the same time, it uses normalization and indicator functions to accurately filter the calculation range. While balancing the weights of different tasks, it improves the robustness and accuracy of the model, allowing the model to learn draft scale-related features more effectively and accurately identify the category and position of draft scale elements.
[0029] The complete loss function in step three is: Combining the waterline detection classification loss, waterline structure loss, and draft scale detection module loss allows the model to simultaneously optimize both waterline and draft scale detection tasks, avoiding biases caused by training each task separately and improving overall detection performance. By adjusting the hyperparameter λ, the weight ratio of different losses in the total loss can be flexibly balanced, allowing the model to adapt to diverse detection needs and enhancing generalization ability. This function enables the model to learn ship draft-related features from multiple perspectives, achieving more accurate and stable detection in complex environments and under different ship conditions, reducing detection errors and providing strong support for accurate calculation of ship draft.
[0030] In step four, for vessels with identifiable draft dimensions, the closest dimension to the waterline is defined as... Its adjacent scale is water and The relative distance is d , and The relative distance is Draft , The closest scale to the water surface Its adjacent scale, and > ,make sure Positive value , Based on a simple, intuitive principle conforming to geometric proportions, and utilizing readily available relative distance information between the waterline and draft, the draft depth can be calculated quickly and accurately. This calculation method is logically clear and computationally simple, requiring no complex conversions or additional information. Results can be directly derived from the actual conditions of the ship's draft markings, improving the efficiency and accuracy of draft depth calculation. This facilitates timely acquisition of draft data during navigation, effectively ensuring the safe operation of ships. The value is greater than Therefore positive 。
[0031] In step four, for vessels whose draft cannot be identified, the distance from the waterline boundary to the freeboard is calculated. The formula is in The water boundary line for the ship is represented by pixels. For the freeboard, T Obtain values for the camera reference point. Z For the gimbal's zoom, for Z=1 Double Taking into account the actual camera parameters, the pixel row of the boat-water boundary was determined. freeboard Values obtained from camera reference points T Gimbal zoom Z as well as Z=1 Double In combination, this allows for the accurate conversion of image pixel information into actual physical distance. This formula fully considers the actual conditions during camera shooting, such as the impact of gimbal zoom on the size and position of objects in the image, making the calculation results more consistent with reality. The distance calculated in this way lays the foundation for subsequent accurate draft calculations. In ship draft inspection, even if the draft scale cannot be directly identified, this formula can be used to accurately estimate the draft using images and camera parameters, improving the adaptability and accuracy of draft inspection methods and ensuring smooth ship draft inspection under various complex conditions.
[0032] In step four, for ships whose draft cannot be identified, the ratio of the actual height to the pixel height is calculated.
[0033] , The camera's height above the water surface; calculate the distance from the actual ship's waterline to the freeboard. ; Draft D = C - R, C To accommodate the ship's depth, the camera's height above the water surface was introduced. By using parameters such as [specific parameters], the pixel height in the image is converted into the actual height, establishing an accurate connection between image information and actual physical quantities. Using this conversion, the distance from the actual waterline to the freeboard of a ship can be precisely calculated. R Combined with the ship's shape depth C This allows us to determine a reliable draft. D This calculation process fully considers the complex situations that may be encountered in ship draft detection. Even if the draft scale cannot be directly identified, the draft depth can be accurately estimated by using camera parameters and image pixel information, which improves the applicability and accuracy of the draft detection method and ensures that reliable draft depth data support can be provided for safe navigation of ships in different scenarios; the final draft depth D=CR.
[0034] The vessel capture system comprises thermal imaging wide-angle cameras and pan-tilt cameras on both sides of the waterway. The draft marker detection dataset contains images of various types of vessels under different environments, including varying lighting conditions and weather conditions. When querying the vessel database, it also retrieves historical draft data. The capture system, composed of thermal imaging wide-angle cameras and pan-tilt cameras on both sides of the waterway, can capture vessel images from all angles and perspectives. The thermal imaging wide-angle cameras are not limited by lighting conditions and can clearly capture vessel outlines even in complex lighting environments such as at night, under strong direct sunlight, or against the light, ensuring no vessel information is missed. The pan-tilt cameras can flexibly adjust the shooting angle, accurately focusing on the vessel's draft marker area to acquire high-definition image details. This provides high-quality image data support for subsequent accurate identification of vessel names, detection of draft markers and waterlines, improving the accuracy and reliability of detection. The draft marker detection dataset covers images of various types of vessels under different lighting conditions and weather conditions, greatly enriching the diversity of the data. Different types of ships have different draft marking styles, positions, and ship structures. Diverse datasets allow the YOLOv8 network to learn the characteristics of various ships, enhancing the model's adaptability to different ships. Image data from different environments enables the model to adapt to complex and varied shooting conditions. In actual detection, regardless of lighting or weather conditions, it can stably and accurately detect draft marking areas, improving the robustness of the detection system.
[0035] In step four, for vessels whose draft dimensions cannot be identified, camera parameters need to be calibrated when calculating draft depth. The calibration method involves taking a picture of a standard object of known size and comparing the actual size with the image size to calculate calibration parameters. When calculating the draft depth of vessels whose draft dimensions cannot be identified, calibrating camera parameters using a specific calibration method can significantly improve the accuracy of draft depth calculation. In actual use, the ratio of the image size captured by a camera to the actual size of the object is easily affected by various factors, such as lens distortion and changes in shooting distance. This can lead to significant errors when directly calculating draft depth based on the image. Taking a picture of a standard object of known size and comparing the actual size with the image size to calculate calibration parameters can effectively eliminate the interference of these factors.
[0036] For example, before calibration, lens distortion may cause the captured images of the ship's freeboard to be stretched or compressed, resulting in inaccurate freeboard height calculations and consequently affecting draft calculations. After calibration, adjusting the image size according to accurate calibration parameters allows for a more precise determination of the actual distance between the ship's waterline and the freeboard, thus making the draft calculation closer to the true value. Furthermore, calibration enhances the versatility of the detection system. Even with camera replacement or changes in the shooting environment, calibration ensures the accuracy of draft calculations, guaranteeing reliable operation of ship draft detection under various conditions and providing stronger data support for safe navigation.
[0037] In practical use, Obtaining vessel information: High-resolution photos of vessels entering the lock are captured using a vessel capture system on both sides of the waterway, utilizing thermal imaging wide-angle cameras and pan-tilt cameras. YOLOv8 The object detection network processes the input ship image to obtain the ship's name. Based on the ship's name, it queries the ship database to obtain the ship's identity information, including its draft and depth, and also retrieves the ship's historical draft data.
[0038] Draft marker detection: A draft marker detection dataset was constructed, containing images of various types of ships under different lighting conditions, such as direct sunlight, backlighting, and dim lighting, as well as different weather conditions, such as sunny days, heavy rain, and dense fog. The dataset was then used... YOLOv8 The network is trained on this dataset, and the trained network is used to detect and locate draft marker regions.
[0039] Waterline detection and draft scale identification: The output draft marker region feature map is divided into columns. Based on the proportional relationship determined in the above study, assuming the draft marker region feature map width is 100 pixels and the height is 80 pixels, the number of columns is selected. w=80 Number of cells h=64 Treating waterline detection as a binary classification task, let the image features be... X , No. iThe classifier used to select the waterline position in the column is The probability formula corresponding to waterline detection is: .
[0040] The loss function corresponding to waterline detection optimization is: Structural loss optimization is used to select the waterline location. When predicting the waterline location, first use... softmax The function yields the probability at different positions. Then through the formula
[0041] Calculate the waterline position; the structural loss function is... .
[0043] A draft scale detection module is added, which obtains the category and location information of each pixel in the feature map. Object Branches and Classification The branches are processed according to the network structure described above, and the target category label for each position is denoted as . , The class label for the integer marker at the location is The regression target for the position is The loss function for the draft measurement module is:
[0044] The complete loss function is Adjust the hyperparameter λ according to the actual situation. Calculate the draft: For ships with identifiable draft dimensions, let the closest dimension to the water surface be λ. Its adjacent scale is water and The relative distance is d , and The relative distance is Draft
[0045] The closest scale to the water surface Its adjacent scale, and > ,make sure It is a positive value.
[0046] For vessels whose draft cannot be determined, first calculate the distance from the waterline boundary to the freeboard. Camera reference point acquisition value T=1.2 Gimbal zoom Z=2 , Z=1 Double =10 Calculates the ratio of actual height to pixel height.
[0047] The camera's height above the water surface; calculate the distance from the actual ship's waterline to the freeboard. Draft D = C - R, C For ship depth For vessels whose draft cannot be determined, first calculate the distance h1 from the waterline to the freeboard. Calculate the ratio of actual height to pixel height.
[0048] Calculate the distance from the actual ship's waterline to the freeboard. Actual calculations should be based on accurate Value, draft D = C R .
[0049] Before calculating the draft, camera calibration is performed using a standard object of known size, and calibration parameters are calculated.
[0050] The pixel height-related parameters involved in the above draft calculation process are calibrated and adjusted.
[0051] Example 2 like Figures 1 - 8 As shown, a method for detecting ship draft based on cell binary classification includes the following steps: Step 1: As Figure 2 As shown, high-resolution photos of vessels entering the lock are captured by a vessel capture system on both sides of the waterway. YOLOv8 The object detection network processes the input ship image and obtains the ship name. Based on the ship name, it queries the ship database to obtain the ship's identity information, including the ship's shape and depth.
[0052] Step 2: As Figures 3 - 4 As shown, using YOLOv8 An object detection network is used to detect and locate draft marker regions. A draft marker detection dataset is constructed, containing images of multiple ship types, and employs... YOLOv8 The network was trained on this dataset. By locating the draft marker regions of ships in the images, it lays the foundation for subsequent draft scale recognition and ship water segmentation processing.
[0053] Step 3: As Figure 5 As shown, waterline detection and draft scale recognition employ a column-based waterline detection method. This method divides the feature map of the output draft marker region into columns, and each column is further subdivided into multiple cells. The waterline marker is a cell within a given column. Therefore, waterline detection can be viewed as a binary classification task, significantly reducing computational complexity compared to segmentation tasks. The specific method is as follows: Let w be the number of columns, and w be the number of cells in each column. h The total number is w×h Assuming X Image features , It is the first i The classifier used to select the waterline location treats waterline detection as a binary classification problem, where positive values represent the waterline and negative values represent the background.
[0054] in It is h A dimensional vector, represented as X The first in i Column selection h The probability of each grid cell, and Assuming It is the first i If the label is in the correct position on the column, the loss function corresponding to the optimization of the waterline detection is as follows:
[0055] in It is cross-entropy (CE) Loss. The above formula can predict the probability distribution of all positions in each column, thus selecting the correct waterline position. Since the classification loss lacks spatial constraints, the method also employs structural loss to optimize the selection of the waterline position. The most direct way to predict the waterline position in each column is to find the maximum response peak from the position classification prediction. For any column index... i Waterline Loci The position can be represented as
[0056] in It is an integer cell index. ,t .but, argmax The function is not differentiable, so we use [the appropriate term here]. softmax Use a function to obtain the probability of different positions.
[0057] in It is h A dimensional vector, representing the 3rd dimension vector. i The probability of a column cell. This represents the probability at each position. Its expected value is...
[0058] in It is the first iList of the first t The probability of each position. The structural loss is as follows, where... It is the first i The actual position on each column.
[0059]
[0060] Building upon this, a draft scale detection module is added. This module can obtain the category and location of each pixel in the feature map. For each location on the feature map... (x, y) , Object The branch determines whether the current position is the background, an integer marker, or a decimal marker. Classification A branch is an integer marker that determines the current position. Let... Maskobj For the category information at each location on the feature map, if (x, y) Falling into any integer marker box ground - truth ,but Maskobj(x, y) = 1 .if groundtruth It is a decimal mark. Maskobj(x, y) = 0 If it's the background, Maskobj(x, y)= 1 .for Maskobj(x, y) = 1 The location will be further classified to obtain the category prediction results for integer labels. Besides classification, for Maskobj(x, y) ≥ 0 Position, four-dimensional vector dx,y = [dl, dr, dt, db] Return to (x, y) The target bounding box at the location, where dl, dr, dt, db express (x, y) Distance from the left, right, top, and bottom boundaries of the bounding box.
[0061] Let the target category label for each location be... The class label for the integer marker at the location is The regression target for the position is Then the loss function of the draft scale detection module can be written as:
[0062] in It is the weighted cross-entropy. (WCE) The weights for loss, background, decimal label, and integer label were set to 0.2, 0.4, and 0.4, respectively. yes In loss. Indicates the number of draft scale symbols. Indicates the number of integer tokens. and It is an indicator function; it returns 1 if the condition is met, and 0 otherwise.
[0063] The complete loss function is as follows:
[0064] Step Four: As Figures 6 - 7 As shown, the draft is calculated.
[0065] For vessels whose draft can be identified, the current draft depth is estimated based on the relative position of the waterline and the draft ratio.
[0066] It is the closest scale to the water surface. yes Adjacent scales, It is water and The relative distance, yes and neighboring scales The relative distance. Then the draft. D Calculated using the following formula
[0067] For vessels whose draft cannot be determined, the method of calculating the difference between the molded depth and the freeboard height is used, as follows: Since the height captured by the model is the pixel height of the image, it is necessary to convert the pixel height into the actual height based on the parameters when the camera captures the image.
[0068] First, calculate the distance from the ship's waterline boundary to the ship's freeboard. Let the water boundary between the ship and the water be... (pixel row), freeboard line is .
[0069]
[0070] In the formula This is used to obtain the camera reference point, where the value is 1.2. For the gimbal's zoom, for Double , The focal length parameter of the camera is used to characterize the camera's imaging capability at a reference zoom level. Next, the ratio of actual height to pixel height is calculated. , This refers to the height of the camera above the water surface.
[0071]
[0072] Recalculate the distance R from the actual ship's waterline to the freeboard.
[0073] Finally, calculate the draft. , ,in For ship type depth.
[0074] The above are merely embodiments of the present invention. Commonly known structures and characteristics of the solutions are not described in detail here. Those skilled in the art are aware of all common technical knowledge in the field prior to the application date or priority date, are aware of all existing technologies in that field, and have the ability to apply conventional experimental methods prior to that date. Those skilled in the art can, under the guidance of this application, improve and implement this solution in combination with their own capabilities. Some typical known structures or methods should not be obstacles for those skilled in the art to implement this application. It should be noted that those skilled in the art can make several modifications and improvements without departing from the structure of the present invention. These should also be considered within the scope of protection of the present invention, and will not affect the effectiveness of the implementation of the present invention or the practicality of the patent. The scope of protection claimed in this application should be determined by the content of its claims, and the specific embodiments described in the specification can be used to interpret the content of the claims.
Claims
1. A method for detecting ship draft based on cell-based binary classification, characterized in that, Includes the following steps: Step 1: Capture photos of vessels entering the lock using the vessel capture systems on both sides of the waterway, and then use... YOLOv8 The object detection network processes the input ship hull photo image to obtain the ship name, and queries the ship database based on the ship name to obtain the ship identity information, including the ship type and depth; Step 2: Construct a draft marker detection dataset, using... YOLOv8 The network is trained on this dataset, and utilizes the trained data. YOLOv8 Target detection networks detect and locate draft marker regions; Step 3: Detect the waterline and identify the draft, as detailed below: The output feature map of the draft marking region is divided into columns, and each column is further subdivided into multiple cells. Waterline detection is treated as a binary classification task; let the number of columns be... w The number of cells in each column is h The total number is w×h Image features are X , No. i The classifier used to select the waterline position in the column is The probability formula corresponding to waterline detection is: , It is h dimensional vector, i∈[1,w]; The loss function corresponding to waterline detection optimization is: ,in It is the first i Label the column in the correct position. It is cross-entropy loss; Structural loss optimization is used to select the waterline location. When predicting the waterline location, first use... softmax The function yields the probability at different positions. Then through the formula Calculate the waterline position; the structural loss function is... in It is the first i The actual position on each column; Step 4: For vessels with identifiable draft dimensions, estimate the draft depth based on the relative positions of the waterline and draft ratio; for vessels with unidentifiable draft dimensions, first convert the pixel height to the actual height, then calculate the difference between the molded depth and the freeboard height to obtain the draft depth. The draft ratio refers to the proportion of the spacing between adjacent scale markings on the vessel's draft mark.
2. The ship draft detection method based on cell binary classification according to claim 1, characterized in that, In step three, a draft scale detection module is added. This module acquires the category and location information of each pixel in the feature map; for the location on the feature map... (x,y) , Object The branch determines whether it is background, integer marker, or decimal marker. Classification The branch determines the integer label category; let the target category label for each position be... t* , Maskobj=1 The class label for the integer marker at position is c*, and the regression objective for position is... d* The loss function of the draft scale detection module is: in This is the weighted cross-entropy (WCE) loss, with weights for background, decimal label, and integer label set to 0.2, 0.4, and 0.4, respectively. yes UnitBox In IoU loss, Indicates the number of draft scale symbols. Indicates the number of integer tokens. and It is an indicator function that returns 1 when the corresponding condition is met, and 0 otherwise.
3. The method for detecting ship draft based on cell binary classification according to claim 1, characterized in that, The complete loss function in step three is: .
4. The ship draft detection method based on cell binary classification according to claim 1, characterized in that, In step four, for vessels with identifiable draft dimensions, the closest dimension to the waterline is defined as... Its adjacent scale is water and The relative distance is d. and The relative distance is Draft The closest scale to the water surface Its adjacent scale, and > ,make sure It is a positive value.
5. The ship draft detection method based on cell binary classification according to claim 1, characterized in that, In step four, for vessels whose draft cannot be identified, the distance from the waterline to the freeboard is calculated. The formula is in The water boundary line for the ship is represented by pixels. Here, T represents the freeboard line, T is the value acquired by the camera's reference point, and Z is the zoom level of the gimbal. For Z=1 times .
6. The ship draft detection method based on cell binary classification according to claim 1, characterized in that, In step four, for ships whose draft cannot be identified, the ratio of actual height to pixel height is calculated. , The height of the camera above the water surface; Calculate the distance from the actual ship's waterline to the freeboard. Draft D= CR, C For ship type depth.
7. The ship draft detection method based on cell binary classification according to claim 1, characterized in that, The ship capture system includes thermal imaging wide-angle cameras and pan-tilt cameras on both sides of the waterway; and the draft marker detection dataset contains images of various types of ships in different environments, including different lighting conditions and different weather conditions; when querying ship database information, it also obtains the ship's past draft data.
8. The method for detecting ship draft based on cell binary classification according to claim 1, characterized in that... In step four, for vessels whose draft cannot be identified, camera parameters need to be calibrated when calculating draft. The calibration method involves taking a picture of a standard object of known size, comparing the actual size with the image size to calculate calibration parameters. The specific calibration process is as follows: Under a fixed shooting angle and distance, take a picture of a standard object with a known side length... L Given a standard object, obtain the side length of that object in the image. l Through formula Calculate the calibration parameter k, and apply this calibration parameter to adjust the relevant data in subsequent draft calculations.