# RHS-YOLOv8: A Lightweight Underwater Small Object Detection Algorithm Based on Improved YOLOv8
## 2 Methodology
### Ref-Dilated Convolutional Block  
Due to the complexity and timeliness of underwater detection tasks, the feature extraction and contextual information aggregation capabilities of the detection models are more demanding. Ref-Dilated block combines the ideas of dilated convolution [35] and RefConv (Re-parameterized Refocusing Convolution) [36], aiming to improve the detection of small objects while controlling the computational cost. The block divides the input feature map \(x\) into the four branches \(x_{1},x_{2},x_{3},x_{4}\), each using a different convolution strategy, and then stitches the results together. The structure of the Ref-Dilated block in the modified C2f module, as well as its internal structure, are shown in Figures 2 and 3, respectively.  
Figure 1: The network structure of RHS-YOLOv8.  
Figure 2: The structure of the improved C2f module.  
\(x_{1}\) is convolved using an ordinary 3 \(\times\) 3 convolution kernel, expressed as in Equation (1).  
\[x_{1}=\text{Conv}_{3\times 3}(x) \tag{1}\]  
where Conv denotes the convolution operation. \(x_{2}\) and \(x_{3}\) perform cavity convolution with a dilation rate of 3. \(x_{2}\) performs cavity convolution using a 3 \(\times\) 3 convolution kernel, which is equivalent to a 9 \(\times\) 9 receptive field, while \(x_{3}\) performs cavity convolution using a 7 \(\times\) 7 convolution kernel, which yields a larger equivalent 21 \(\times\) 21 receptive field, expressed as in Equation (2) and Equation (3).  
\[x_{2}=\text{DilatedConv}_{3\times 3,rate=3}(x) \tag{2}\]  
\[x_{3}=\text{DilatedConv}_{7\times 7,rate=3}(x) \tag{3}\]  
where DilatedConv shows the null convolution operation, and rate is the expansion rate. \(x_{4}\) uses a 3 \(\times\) 3 convolution kernel with feature transformation via the RefConv operation, which contains an additional learnable parameterization matrix formulation, as in Equation (4).  
\[x_{4}=\text{RefConv}_{3\times 3}(x) \tag{4}\]  
Then, the output features of the four branches are spliced as \(x_{concat}\) and then downscaled, and the number of channels is adjusted by a 1 \(\times\) 1 convolution, expressed as in Equation (5).  
\[x_{concat}=\text{Concat}(x_{1},x_{2},x_{3},x_{4}) \tag{5}\]  
To enhance the generalization ability of the model, the spliced feature \(x_{concat}\) is regularized to \(x_{dp}\) with DropPath, expressed as in Equation (6).  
\[x_{dp}=\text{DropPath}(x_{concat}) \tag{6}\]  
Finally, the original input x and the DropPath-processed feature \(x_{dp}\) are fused, e.g., by element summing or channel splicing, expressed as in Equation (7).  
\[x_{output}=x+x_{dp}\text{ or }x_{output}=\text{Concat}(x,x_{dp}) \tag{7}\]  
Figure 3: The structure of the Ref-Dilated block.  
Dilated convolution can expand the receptive field by introducing an expansion coefficient, thus capturing more feature information at different receptive field scales, which is particularly suitable for coping with underwater targets of varying sizes. RefConv improves the expressive power of feature extraction and optimizes the computational efficiency of the network by reparametrizing the weights in the training and inference phases. In this way, the Ref-Dilated block combines the multi-scale sensory field of null convolution and the strong feature extraction capability of RefConv, while maintaining a low computational cost.