Yuankui Li, Ziqi Jia, Xinyu Zhang, Fang Yang, Xuefeng Yang
Due to the complex and dense traffic in ports and their surrounding sea areas, along with the diverse and varying sizes of ships, ship detection faces significant challenges. To address these challenges, a YOLOv8n-based ship detection method is proposed in this work. Firstly, based on YOLOv8n, two attention mechanism-CBAM and EMA-are integrated to improve attention allocation to ship target features in visible-spectrum imagery, thereby improving the feature extraction capability for multiscale ships. Secondly, considering the characteristics of overlapping ships and significant scale variations, a novel Loss function MPDIoU is adopted to address the inaccurate detection in scenarios with overlapping ships. Finally, a slim-neck lightweight neck structure is designed to reduce computational complexity while maintaining performance, thereby enhancing the inference speed of the network. Following these improvements, a ship target detection model named MSM-YOLOv8 was developed. Performance evaluation using the Seaships dataset demonstrates that MSM-YOLOv8 outperformed the baseline YOLOv8n in ship detection task, achieving an increase of 1.0 % in precision and 3.4 % in mAP@50–95 , respectively. The proposed MSM-YOLOv8 was further validated both on Seaships dataset and ship images captured in real-world conditions, with the results confirming its effectiveness in accurately detecting and classifying various types of ship targets. In addition, experiments on the more complex ABOships dataset further demonstrate the robustness and generalization ability of the model. Therefore, the lightweight ship detection model proposed in this paper exhibits both theoretical significance and practical value in complex scenarios, and partially mitigates issues related to delayed detection and inaccurate classification of ship targets near ports.