# WDS-YOLO: A Marine Benthos Detection Model Fusing Wavelet Convolution and Deformable Attention
## 3 Methods
### Deformable Attention-Integrated Spatial Pyramid Pooling Fast (DASPPF) Module  
Due to factors such as water flow disturbance and changes in shooting angles, marine benthos objects often exhibit diverse forms, and some objects have protective colors that are difficult to distinguish from the surrounding background environment. Moreover, non-uniform illumination and background disturbances in intricate underwater settings impair the interdependencies among pixels, resulting in the obfuscation of critical information on marine benthos objects. Furthermore, Convolutional Neural Networks (CNNs) extract picture data using restricted receptive fields limited to local areas, leading to inadequate contextual information. We designed the DASPPF module utilizing deformable attention methods [50] to let the detection model disregard unnecessary background and concentrate on pertinent marine benthos feature information. It executes attention computation on the feature  
Figure 4: C2f-WTConv module structure. Figure 3: An example of the WTConv. maps integrated by the Fast Spatial Pyramid Pooling architecture to capture long-range relationships, hence maximizing the correlations among feature elements and extracting more representative features. In conventional self-attention mechanisms [52], each query must associate with all potential keys in the image space to calculate attention weights, resulting in heightened model parameters and substantial computing expenses. Moreover, given that the majority of marine benthos objects constitute a tiny fraction of images, this means that this method will inevitably introduce a significant volume of extraneous information, interfering with the accurate detection of marine benthos. Deformable attention integrates the sparse spatial sampling proficiency of deformable convolution and the effective modeling capacity of self-attention for data correlations. Its primary advantage resides in its robust capacity to articulate the comprehensive characteristics of data. It may adaptively and dynamically modify the attention domain of each query and prioritize the significance of features according to input variations, enhancing feature representation's relevance to target objects, thereby efficiently diminishing irrelevant information and alleviating background noise. Figure 5 illustrates the principle of deformable attention. For a specified input feature \(\mathrm{x}\in\mathbb{R}^{\mathrm{H}\times\mathrm{W}\times\mathrm{C}}\), a set of reference points \(\mathrm{p}\in\mathbb{R}^{\mathrm{H}/r\times\mathrm{W}/r\times 2}\) is generated (where r is a predetermined parameter), while the input \(x\) undergoes linear projection to obtain the query tokens \(q\). The \(q\) is then processed by the offset learning network \(\theta_{offset}\) to compute the relevant offsets \(\Delta p\) for the reference points. The deformed points are computed using the offsets and reference points, and the sampled features \(\overset{\sim}{x}\) are derived by bilinear interpolation of the input features and the coordinates of the deformed points. The formula for calculation is as follows:  
\[q=xW_{q} \tag{4}\]  
\[\Delta p=s\cdot\tanh\bigl{(}\theta_{offset}(q)\bigr{)} \tag{5}\]  
\[\overset{\sim}{x}=\phi(x;p+\Delta p) \tag{6}\]  
Figure 5: Deformable attention module structure. where \(W_{q}\) represents the projection matrix, \(s\) is the range parameter to prevent excessive offsets, and \(\phi(\cdot\,;\,)\) is the bilinear interpolation sampling function. Subsequently, the sampled features are projected to obtain the key \(\overset{\sim}{k}\) and value \(\overset{\sim}{v}\) embeddings:  
\[\overset{\sim}{k}=\overset{\sim}{x}W_{k} \tag{7}\]  
\[\overset{\sim}{v}=\overset{\sim}{x}W_{v} \tag{8}\]  
Finally, the multi-head attention output is computed by incorporating the relative position offset \(R\), yielding the output features \(z\in\mathbb{R}^{\text{H}\times\text{W}\times\text{C}}\).