# HS-YOLO: Small Object Detection for Power Operation Scenarios
## 2 Related Works and Methods
### Methods
#### 2.2.3 Feature Fusion Network  
The Neck in YOLOv5s utilizes the structures of the Path Aggregation Network (PANet) to enhance semantic representation and localization capability across multiple scales. The network performs upsampling of feature maps using nearest neighbor interpolation, where each object pixel is individually copied and enlarged. However, since small objects occupy a limited number of pixels in the image, the feature information carried by each object pixel becomes sparse and insufficient after being individually replicated and enlarged. This may result in the loss of fine details around small objects. Furthermore, the nearest neighbor interpolation method only considers the closest pixel values and ignores the smooth transition between neighboring pixels. As a result, the upsampled feature maps may exhibit noticeable aliasing artifacts, leading to distorted or deformed shapes of small objects. This distortion increases the complexity of detection algorithms to accurately recognize and pinpoint small objects.  
To address the aforementioned issue, we introduce sub-pixel convolution into the FPN structure. Sub-pixel convolution splits each pixel value into multiple sub-pixels and recombines them across channels, transforming the original low-resolution feature map with dimensions \(\mathrm{H}\times\mathrm{W}\times\mathrm{C}\cdot\mathrm{r}^{2}\) into a high-resolution feature map with dimensions \(\mathrm{rH}\times\mathrm{rW}\times\mathrm{C}\), achieving the effect of upsampling, as shown in Figure 4. More precisely, every low-resolution pixel is subdivided into smaller \(\mathrm{r}\times\mathrm{r}\) grids. The pixel shuffle operations are applied to populate these grids with values from the corresponding positions in \(\mathrm{r}\times\mathrm{r}\) feature maps. By applying the same pixel shuffle operation to fill each grid, the recombination process is completed. The calculation can be expressed as shown in Equations (1) and (2).  
\[\mathrm{I}^{\mathrm{HR}}=\mathrm{PS}(\mathrm{I}^{\mathrm{LR}}) \tag{1}\]  
\[\mathrm{PS}(\mathrm{T})_{\mathrm{x,y,c}}=\mathrm{T}_{[\mathrm{x/r}],[\mathrm{ y/r}],\mathrm{c}\cdot\mathrm{r}\cdot\mathrm{mod}(y,\mathrm{r})+\mathrm{c}\cdot \mathrm{mod}(\mathrm{x,r})} \tag{2}\]  
where \(\mathrm{I}^{\mathrm{LR}}\) represents the low-resolution feature map; \(\mathrm{I}^{\mathrm{HR}}\) represents the high-resolution feature map; \(\mathrm{x}\) and \(\mathrm{y}\) represent the coordinates in the \(\mathrm{rH}\) and \(\mathrm{rW}\) dimensions of the high-resolution image; \(\mathrm{T}\) represents the input feature; \(\mathrm{c}\) represents the final number of channels after sub-pixel convolution; and \(\mathrm{r}\) represents the upsampling factor; \(\mathrm{PS}\) is a periodic pixel shuffle operation that cyclically inserts pixels from the channels into the image.  
Compared to simple interpolation methods, sub-pixel convolutional upsampling can better reconstruct subtle variations in the image, making the boundaries and textures of small objects clearer. Additionally, sub-pixel convolutional upsampling can enlarge the receptive field, allowing the network to capture better contextual information in the vicinity of objects. This enhancement bolsters the model's adaptability to small objects, particularly in intricate backgrounds, and aids in distinguishing small objects from the background.  
Figure 3: Different resolution feature map fusion methods.