## 3 Methods
### Segmentation Head Module  
In the head module, the network processes feature maps generated by the backbone at different scales. These feature maps undergo a series of operations before being passed to the detection and segmentation modules for final predictions. The detection module is responsible for target classification and bounding box regression, while the segmentation module generates segmentation masks for the targets. This design allows the network to perform both target detection and instance segmentation tasks. To handle targets of varying sizes and complexities, the network employs a multi-scale prediction mechanism, processing feature maps at three different depths. Deeper feature maps are used for detecting and segmenting larger targets, while shallower feature maps focus on smaller, detail-rich targets. This approach leverages the advantages of feature maps at different scales, ensuring high accuracy when handling multi-scale targets. For network structure, feature representation is further enhanced by merging feature maps of different scales using upsampling and feature fusion techniques. For instance, the network combines shallow and deep features through Upsample and Concat operations to improve target detection and segmentation at various scales. Additionally, the network incorporates the RepNCSPELAN4 module, an efficient feature extraction structure that integrates the attention mechanism and convolution operation to optimize feature extraction. Finally, the segmentation module generates segmentation masks for each target, enabling pixel-level segmentation. This parallel multi-scale design enables the network to achieve accurate target detection and high-quality segmentation in complex visual tasks, ensuring precise localization and clear, detailed segmentation results. The specific process of instance segmentation is as follows:  
We use \(P_{16}\), \(P_{19}\), and \(P_{22}\) for multi-scale predictions. These feature maps contain rich spatial information, which is crucial for detecting and segmenting objects of varying sizes. The model generates bounding box regression values and class scores using different ModuleList modules for each scale. Each scale's feature map \(P_{i}\) is passed through the corresponding module to produce bounding box regression values and class scores. Specifically, for each feature map \(P_{i}\), the detection branch generates the output \(D_{i}\):  
\[\text{D}_{i}=\text{DetectBranch}(\text{P}_{i}),\;\text{i}\in\{16,\;19,\;22\} \tag{12}\]  
Here, \(\text{DetectBranch}(\cdot)\) refers to the process that extracts bounding box regression values and class scores from the feature map. The detection outputs from each scale are then decoded to generate the final detection results, including bounding boxes and class scores:  
\[\text{Box}=\text{BoxDecoder}(\text{D}_{16},\;\text{D}_{19},\;\text{D}_{22}) \tag{13}\]  
\[\text{Cls}=\text{ClassDecoder}(\text{D}_{16},\;\text{D}_{19},\;\text{D}_{22}) \tag{14}\]  
Next, the outputs from all scales are concatenated to form the final detection result. In the instance segmentation task, the model first extracts the shallowest feature map \(P_{16}\) and uses it to generate prototype masks \(P_{proto}\). This feature map is passed through a dedicated branch for mask generation. For each feature map \(P_{i}\), we compute the corresponding mask coefficients \(C_{i}\):  
\[\text{C}_{i}\text{=MaskCoeff}\;(\text{P}_{i}),\;\text{i}\in\{16,\;19,\;22\} \tag{15}\]These mask coefficients have dimensions [Batch size, \(\rm n_{m}\), \(\rm H_{i}\)\(\cdot\)\(\rm W_{i}\)], where \(\rm n_{m}\) denotes the number of mask coefficients per target, and \(\rm H_{i}\) and \(\rm W_{i}\) correspond to the spatial dimensions of each scale's feature map.