# Research on Improved Lightweight YOLOv5s for Multi-Scale Ship Target Detection
## 1 Introduction  
For a long time, the maritime field has been facing many challenges, including collision risks caused by human factors, illegal smuggling and infiltration, maritime traffic control, maritime emergency rescue, and port management. In order to solve these problems, ship target recognition technology has gradually become the focus of scholars' research. This technology provides new solutions to potential problems in the maritime field with its fast and accurate recognition performance, data integration, and monitoring capabilities.  
In recent years, CNN (convolutional neural networks) technology has occupied an important position in the field of ship target recognition due to its excellent feature extraction ability, hierarchical feature learning ability, and generalization ability. Depending on the different ways and processes of target detection tasks, the target detection algorithms are usually divided into two categories: single-stage target detection and two-stage target detection. The two-stage target detection algorithm first generates candidate areas through the region proposal network and then performs target detection and classification on these candidate areas. It can usually achieve high detection accuracy and is suitable for complex scenes and small target detection. Common two-stage target detection algorithms include Faster R-CNN [1], Mask R-CNN [2], and Cascade R-CNN [3]. Different from thetwo-stage target detection algorithm, the one-stage target detection algorithm detects the target directly from the image without generating candidate frames. This is suitable for scenarios that require high detection speed, for example, YOLO [4], SSD [5], RetinaNet [6], YOLOv3 [7], and other algorithms. However, the detection accuracy is relatively low.  
Yolov5 is currently an algorithm with good comprehensive detection performance and fast detection speed, and it is widely used in target recognition tasks in different fields. In marine transportation, there are many types of marine structures, large scale differences, and harsh marine environments (such as fog, occlusion, and backlight), which makes marine target detection face great challenges. In addition, in order to reduce operating costs, the hardware resources carried by ships are limited. Therefore, in order to meet the needs of multi-scene and different-scale ship target detection on edge devices with limited computing resources, this study designed and tested a lightweight multi-scale ship target recognition algorithm YOLOv5s_ESGW (ESGW is composed of the abbreviations of Ef-ficientNetV2, Shuffle Attention, Ghostnet, and Wise-IoU, representing the model improvement process). The main contributions include the following: (1) A multi-scenario and multi-scale ship visible light dataset is produced. The dataset covers mainstream ship types of different scales and also includes scenes such as fog, occlusion, and backlight. (2) Based on a lightweight network, the feature extraction capability, network depth, and width of the Yolov5 model are optimized, and the number of model parameters and calculations are compressed while ensuring the model detection accuracy, thereby improving the model's inference speed. (3) A lightweight attention module is integrated into the model to express important feature information in the image, suppress unimportant feature information, and improve the model's detection capability. (4) Wise-IoU is used as the bounding box loss function to improve the model's detection accuracy for objects of different sizes and shapes, better measure the similarity between the predicted box and the true box, and improve the model's detection performance and robustness.  
The rest of this paper is organized as follows: Section 2 introduces the related work on maritime ship target recognition. Section 3 gives a detailed introduction to the model and improved method proposed in this study. Section 4 introduces and discusses the experimental arrangement and results. Finally, Section 5 summarizes this study and its prospects.