# Semi-Supervised Method for Underwater Object Detection Algorithm Based on Improved YOLOv8
## 3 Materials and Methods
### The Proposed Detection Model, SUD-YOLO
#### 3.2.3 Task-Aligned Lightweight Detection Head Module (TAE)  
The detection head in YOLOv8 exhibits certain limitations that impact its efficiency and performance. First, the detection head consists of a considerable number of parameters, accounting for about one-fifth of the model's total computational load. Specifically, each of the three detection heads includes two 3 \(\times\) 3 convolutional layers and one 1 \(\times\) 1 convolutional layer, leading to a notable increase in the parameter count. Second, the original algorithm employs a single-scale prediction strategy, which is inadequate for detecting objects at multiple scales. This approach restricts predictions to a single scale of the feature map, ignoring the valuable contributions of features from other scales that could potentially improve detection performance. In the context of underwater object detection, where small objects are common, traditional detection methods face significant challenges. A typical single-stage detector uses three detection heads to capture objects at various scales, specifically, large, medium, and small. Among these, the small object detection head is especially crucial for underwater target detection due to the prevalence of small objects. To enhance the detection capability for small objects, this study proposes increasing the number of channels in the small object detection layer. However, this adjustment leads to an increase in both the parameter count and the computational cost of the model. To mitigate the adverse effects of the increased parameter count and computational load, we introduce a shared convolution mechanism into the detection head structure. This not only reduces the number of parameters in the network but also effectively enhances its generalization ability, as demonstrated by previous research [36]. This technique effectively reduces the overall number of parameters, promotes a sparser network, and improves its translational invariance. In this paper, a task-aligned structure [37] is designed in the detection head. The feature extractor learns the interaction features of the task from multiple convolutional layers. This design not only facilitates task interaction, but also provides multi-level features and multi-scale effective receptive fields for both tasks. The localization branch uses DCNv2 (Deformable Convolutional Networks v2) [38], an enhanced convolution technique that adaptively modifies the shape of the convolution kernels to more effectively fit the deformation or multi-scale features of the target. DCNv2 introduces biases to achieve dynamic feature extraction, dynamically adapting to each feature extraction location and incorporating weights to express features uniquely at each position. The introduction of DCNv2 into the detection head significantly improves the localization capability of the model. The complete design of the TAE detection head is shown in Figure 6.  
The complete workflow of the semi-supervised algorithm proposed in this paper is shown in Algorithm 1. 1. Data Preparation: The underwater object detection dataset consists of both labeled and unlabeled data, with a total of \(I+J\) samples, where \(I\) is the number of labeled samples and \(J\) is the number of unlabeled samples, with typically \(J\gg I\). \(D_{L}=\left(x^{i},y^{i}\right)_{i=1}^{I}\) represents the labeled dataset, and \(D_{U}=\left(x^{j},y^{j}\right)_{j=1}^{I}\) represents the unlabeled dataset. Here, \(x\) and \(y\) represent the sample images and the annotation boxes, respectively. 2. Pre-training: Use the small labeled dataset \(D_{L}\) to train the model and obtain the \(M\) initial supervised model weights. 3. Input: \(D_{L}\), \(D_{U}\), and the initial weights \(M\). 4. Output: The final weights file \(F\) of the underwater object detection model. 5. Repeat:  
1. The Teacher model predicts on the unlabeled dataset \(D_{U}\) using weights \(M\) to obtain the pseudo-label dataset \(D_{p}=\left\{(x^{j},y^{j})\right\}_{j=1}^{I}\) and the corresponding prediction probabilities \(p^{j}\). 2.