## 3 Methodology
### DCW-YOLO Algorithm
#### 3.2.2 Carafe  
Upsampling is a common operation in deep neural networks, utilized to boost feature map resolution and size. The most prevalent techniques for feature upsampling are bilinear  
Figure 3: Iteration of DSConv: (**a**) Schematic of the coordinates calculation of the DSConv. (**b**) The receptive field of DSConv.  
interpolation and nearest neighbor; however, they come with certain limitations. These interpolation methods consider only simple comparisons or linear combinations between pixels, disregarding the semantic data in the feature maps. Moreover, the size of their receptive field is restricted to \(1\times 1\), which falls short in supplying the detailed semantic details necessary for dense prediction tasks. Deconvolution is another method of upsampling, which involves convolving the input feature map with a kernel, using padding and stride adjustments to expand the generated feature map's size. Decovolution, on the other hand, uses the same kernel throughout the picture, which compromises its ability to respond to local variations. Moreover, due to its substantial number of parameters, it can impact computational efficiency.  
In this research, we propose the adoption of a lightweight, universal upsampling technique, CARAFE [44], as a replacement for the nearest neighbor interpolation upsampling method in the original YOLOv8 model, thereby capturing richer semantic information. Figure 4 shows the particular structure of CARAFE, comprising an upsampling prediction module and a content-aware reassembly module. The upsampling kernel prediction module generates the upsampling kernels required for the reassembly module in a content-aware manner. Initially, a channel compressor employing a \(1\times 1\) convolutional layer decreases the quantity of channels in the input feature representation from C to \(C_{m}\), significantly decreasing the computational burden. Subsequently, content encoding is applied to the channel-compressed input feature map of size \(H\times W\times C_{m}\), expanding the number of channels from \(C_{m}\) to \(\sigma^{2}\times K^{2}\). The channels are then stretched over the spatial dimension, producing an upsampling kernel that has the form \(\sigma H\times\sigma W\times K^{2}\). A softmax function is then utilized for the standardization of the kernel, guaranteeing that the total weight of the upsampling kernel is unity. Overall, the upsampling prediction module leverages the semantic information contained within each feature point of the input feature map and its surrounding feature points for content encoding. This process adaptively generates the corresponding upsampling reassembly kernels for different feature points.  
In the content-aware reassembly module, for every reassembly kernel \(W_{i}\), the content-aware reassembly module reassembles the features within the local area. For the target position \(l^{\prime}\) and the \(K\times K\) square region \(N\) corresponding to the feature map with \(N(X_{l},k_{up})\) as the center, the process for reassembly is presented in Equation (6), where \(r=\lfloor k_{up}/2\rfloor\). Based on both its own features and the surrounding features, each pixel in the \(N(X_{l},k_{up})\)  
Figure 4: The overall architecture of CARAFE.  
area of the reassembly kernel contributes to the upsampled pixel in a distinct way, rather than its position and distance. Therefore, the reconstructed feature map holds more robust semantic content compared to the initial features.  
\[\chi^{\prime}_{l^{\prime}}=\sum_{n=-r}^{r}\sum_{m=-r}^{r}W_{l^{\prime}(n,m)}\cdot \chi_{(i+n,j+m)} \tag{6}\]  
In contrast to Yolov8's conventional nearest-neighbor interpolation upsampling, the CARAFE upsampling module employs adaptively generated recombination kernels to perform upsampling on each feature point in the image, thereby gathering contextual semantic insights from a wider field of perception. This notably decreases the degradation of image feature details during the upsampling phase, effectively improving the network's ability to extract features.