# RHS-YOLOv8: A Lightweight Underwater Small Object Detection Algorithm Based on Improved YOLOv8
## 2 Methodology  
### Object Detection Algorithm  
The YOLOv8 model, released by Ultralytics in 2023, offers versatile support across a range of computer vision tasks. In object detection specifically, YOLOv8, a newer and well-received version of the YOLO series, combines the high efficiency of traditional convolutional neural networks with the strong expressive power of the Transformer module, resulting in a good balance between inference speed and detection accuracy. In addition, YOLOv8 supports a lightweight version of the model design, which is particularly suitable for resource-constrained underwater detection tasks. Compared to YOLOv5 and YOLOv7, YOLOv8 also introduces a dynamic label assignment strategy, which significantly improves the detection of small objects. Building on YOLOv5, YOLOv8 introduces a novel network structure that combines the strengths of earlier YOLO models with cutting-edge design concepts in object detection algorithms [33]. Overall, YOLOv8 is mainly set up with five versions, n, s, m, l, and x, and a different number of channels is set up for each version, and its network structure provides different magnitudes of the model by varying the channel widths and network depths to enhance the robustness of the model to handle various types of detection tasks. The model structure of YOLOv8 is divided into three parts: the backbone, the neck, and the detection head. The backbone network architecture of YOLOv8 is based on and adapted from the DarkNet53 structure. For example, the C3 module in the feature extraction network is replaced with a C2f module incorporating residual connections, which includes two convolutional cross-stage partial bottlenecks. This modification allows for the integration of high-level features and contextual information with fewer parameters, enhancing feature extraction and leading to improved detection accuracy. The neck section includes an SPPF module, a PAA module, and two PAN modules, using a multi-scale fusion technique to fuse feature maps from the backbone network for enhanced feature representation. In the detection head section, YOLOv8 draws inspiration from the design ideas of YOLOv [34] by using a decoupling head for decoupling, a design that allows each branch to focus on the current prediction task, making the training and inference of the network more efficient. Compared with other YOLO series models, YOLOv8 can have better detection accuracy while maintaining a lower computation volume, which meets the lightweight and high-efficiency requirements of models carried by underwater equipment when performing object detection tasks.  
In this paper, to achieve real-time and high-efficiency detection in underwater images, we use the newly designed Ref-Dilated convolution block to replace the original bottleneck convolution block to improve the structure of the C2f module, design the HBPN to replace the original Concat operation, introduce the ELA attention mechanism and the Involution module, and finally add the small target detection branch to the overall architecture. In the RHS-YOLOv8 model, the backbone consists of various convolution modules. In addition to the convolutional modules, the neck consists of upsampling, downsampling, and connection operations. The network provides four predicted outputs for different sizes of detected objects. The network structure of the improved RHS-YOLOv8 is shown in Figure 1.