# Automated Docking System for LNG Loading Arm Based on Machine Vision and Multi-Sensor Fusion
## 3 Design of a Vision-Based Deep Learning Loading-Arm Positioning System
### Image Feature Extraction  
In the automatic docking system of the LNG loading arm, target detection and positioning are key links in the system, placing high requirements on the accuracy and robustness of the machine vision algorithm. The object detection method based on deep learning, which automatically extracts multi-level image features, has demonstrated superior performance in dynamic environments and has gradually become a core technology in complex industrial scenarios. YOLOv8, as an efficient end-to-end object detection framework, excels in terms of model structure and performance balance, and it provides efficient and reliable visual support for flange detection and segmentation of the LNG loading arm [26; 27; 28]. The YOLOv8 model combines RGB images captured by two monocular cameras and is used in the rough docking and fine docking stages through its object detection and instance segmentation functions, respectively. In the rough docking stage, the system uses the monocular camera to capture images of the target area in real time, and it combines the object detection module of YOLOv8 to quickly identify the flange target, generate target frame position information, and combine geometric constraints to achieve flange positioning, thereby guiding the unloading arm to complete the initial approach to the target. In the fine docking stage, the system further uses the instance segmentation function of YOLOv8 to accurately extract the key contour features of the flange, and it combines image correction and geometric constraints to accurately calculate the 3D coordinates of the flange, thereby achieving high-precision docking of the unloading arm. The models used for fine and coarse docking are trained based on two different datasets. The dataset for coarse docking requires the imaging plane of the camera to be parallel to the flange surface during shooting, as shown in Figure 9a. The dataset for fine docking, however, requires the camera to be located a certain distance above the top of the flange and to be tilted at an angle, as shown in Figure 9b. For labeling, the border tool is used for the coarse docking dataset, while the polygon tool is used for labeling the flange contour for the fine docking dataset. The dataset contains flange targets with different lighting conditions, angle changes, and background complexity to ensure the robustness and adaptability of the model in  
Figure 8: (**a**) Initial attitude of coarse docking, (**b**) coarse-docking completion posture, (**c**) fine-docking initial-positioning mode, and (**d**) precise docking post-positioning mode. Figure 9: (**a**) Coarse docking of target datasets. (**b**) Fine docking of target datasets panel. complex scenes. These datasets include images captured under a variety of lighting conditions, helping the model generalize across different light environments. The data are divided into a training set and a validation set in a 7:3 ratio. The number of training rounds is set to 100, with 8 images processed in each batch. To further improve the generalization ability of the model, the mosaic method is used during data augmentation. These variations in lighting conditions, combined with angle changes and background complexity, allow the model to perform robustly under various environmental conditions, including low-light environments and high-humidity situations. This helps ensure the model's adaptability to real-world conditions where these environmental factors may vary. The performance of object detection tasks is usually evaluated using three indicators, precision (accuracy), recall (recall rate), and mean average precision ([EMAIL_ADDRESS]), which are calculated as follows:  
\[\textit{Precision}=\frac{\textit{TP}}{\textit{TP}+\textit{FP}} \tag{16}\]  
\[\textit{Recall}=\frac{\textit{TP}}{\textit{TP}+\textit{FN}} \tag{17}\]  
where _TP_ is the number of targets correctly predicted, _FP_ is the number of targets incorrectly predicted, and _FN_ is the number of targets missed.