# Research on Improved Lightweight YOLOv5s for Multi-Scale Ship Target Detection
## 3 Data and Methods
### Baseline Model Adopted  
The objective of this research is to construct a lightweight ship target detection model that achieves a balance between model detection accuracy and complexity to meet the requirements for applications on shipboard processing platforms with limited computational and memory resources. Yolov5 is currently a target detection algorithm that is widely used and has advanced detection performance. This model has fast and accurate inference capabilities and detection accuracy. Currently, there are four main network structures of the Yolov5 model, including Yolov5m, Yolov5l, Yolov5x, and Yolov5s. The performance of these models is verified by training and testing on publicly available datasets, as shown in Table 2. From the comprehensive model performance comparison, it is concluded that Yolov5s model has the lowest complexity and relatively faster detection speed, which is more suitable for deployment on hardware devices with limited computational resources. Yolov5x has the highest detection accuracy, but the model is more complex. Therefore, in this research, the Yolov5s model was used as a baseline and improved using a lightweight  
Figure 1: Production process of Marine Structure Datasets.  
ing method to reduce the number of parameters of the model while ensuring the model's detection accuracy.  
The Yolov5 model consists of an input, a backbone network, a neck, and a head. On the input side, a series of processes are performed on the image, including mosaic data augmentation, image sizing, and adaptive anchor frame computation. Mosaic data augmentation utilizes random cropping, flipping, rotating, and color transformations to add variety and complexity to the training dataset. To ensure that fixed-size images can be used during inference, unified scaling technology is used to process input images of different sizes. The backbone network can extract rich and effective features from the input image through the combination and hierarchical stacking of Conv, C3, SPPF, and other modules. The Conv module is the core module in the backbone network. It is mainly used to extract target feature information, prevent over-fitting, and accelerate convergence. The C3 module is a multi-path convolution structure that can increase the depth and width of the network and improve the richness of features. SPPF is a spatial pyramid pooling module that can perform pooling operations on feature maps of different scales to extract feature information of different scales.  
In the Yolov5 neck, the feature pyramid structure of FPNs (Feature Pyramid Networks) and PANs (Path Aggregation Networks) is used to fuse shallow graphic features and deep semantic features. At the same time, it can also extract effective information from multi-scale feature maps, thereby improving the performance of target detection. The detection head module is mainly responsible for multi-scale target detection on the extracted feature information, including the location, category, and confidence of the target frame. The detected target information is processed using techniques such as non-maximum suppression to obtain the final target detection result.