# Efficient Small-Object Detection in Underwater Images Using the Enhanced YOLOv8 Network
## 3 Approach
### Deformable ConvNets V2  
The modeling of geometric transformations in convolutional neural networks (CNNs) is inherently constrained by the fixed grid structures of the kernels. [PERSON] et al. [37] have introduced two innovative modules, namely deformable convolution and deformable RoI pooling, which significantly augment the CNNs' ability to model geometric transformations.  
Deformable convolution innovates by incorporating 2D offsets into standard grid sampling, enabling a flexible deformation of the sampling grid. To facilitate effective learning, offsets are derived from preceding feature maps through additional convolutional layers, ensuring deformation is adaptively conditioned on local input features. The above process can be represented as follows:  
\[Y(p_{0})=\sum_{p_{n}\in\mathrm{R}}w(p_{n})\cdot x(p_{0}+p_{n}+\triangle p_{n}) \tag{1}\]  
\[R=\{(-1,-1),(-1,0),\ldots,(0,1),(1,1)\} \tag{2}\]  
where \(Y(p_{0})\) signifies the output feature map value at position \(p_{0}\), utilizing a 3 \(\times\) 3 kernel grid (\(R\)) with dilation 1. Here, \(x\) represents the input feature map, \(w\) denotes the sampled values' weights, \(p_{n}\) enumerates the coordinates in \(R\), and \(\triangle p_{n}\) represents the deformable convolution augmented offsets.  
Deformable RoI pooling introduces adaptive part localization in objects with varying shapes by incorporating learned offsets into regular RoI pooling positions. These offsets are derived from preceding feature maps and RoIs. In the RoI pooling process, given an input feature map \(x\) and an RoI of size w \(\times\) h with the top-left corner at \(p_{0}\), the RoI is divided into k \(\times\) k bins to generate a k \(\times\) k feature map Y. The process described above can be represented as follows:  
\[Y(i,j)=\sum_{p\in\mathrm{{kin}}(i,j)}x(p_{0}+p+\Delta p_{ij})/n_{ij} \tag{3}\]  
where \(Y(i,j)\) denotes the values from deformable RoI pooling, and \(n_{ij}\) represents the number of pixels in spatial binning positions. \(\Delta p_{ij}\) is computed by a fully connected layer, generating normalized offsets \(\Delta\hat{p_{ij}}\). These offsets are then modulated by a scalar  
Figure 3: Coordinate attention module overview.  
\(\gamma\) (empirically set to 0.1) and multiplied element-wise with RoI's width and height, expressed as \(\Delta p_{ij}=\gamma\cdot\Delta p_{ij}^{\wedge}\circ(w,h)\).  
While Deformable ConvNets v1 shows better spatial feature extraction capabilities compared to regular ConvNets, it can sometimes introduce irrelevant context, which can hurt the algorithm's performance. To address this, [PERSON] et al. [12] introduced Deformable ConvNets v2, which adds weights to the sampling points in Deformable ConvNets v1. Figure 4 illustrates how Deformable ConvNets v2 works on underwater datasets. This can be expressed as follows:  
\[Y(p_{0})=\sum_{p_{n}\in\mathbb{R}}w(p_{n})\cdot x(p_{0}+p_{n}+\triangle p_{n} )\cdot\Delta m_{p_{n}} \tag{4}\]  
\[Y(i,j)=\sum_{p\in bin(i,j)}x(p_{0}+p+\Delta p_{ij})\cdot\Delta m_{ij}/n_{ij} \tag{5}\]  
where \(\Delta m_{p_{n}}\) and \(\Delta m_{ij}\) represent the modulation scalars for each position, with values ranging from 0 to 1, adding input features to adjust their strength at offset positions. This adjustment allows the module to change the spatial distribution of the samples and their mutual influence.  
In our work, we improve YOLOv8 by incorporating Deformable ConvNets v2. We replace the Conv layers in the YOLOv8 Neck, as well as the 3 \(\times\) 3 convolution in the bottleneck of the C2f, with Deformable ConvNets v2. The experimental results show a significant improvement in accuracy, with an increase of 0.72% in AP on the underwater dataset. Specifically, the AP for the irregular category 'holduurian' increased by 1.39%.