## 3 Methods
### Spatial Pyramid Pooling with Effective Partial Self-Attention (SPPEPSA)  
In the human detection task of indoor scenes with limited space and shooting angles, the proportion of targets of different scales is relatively high. Therefore, a well-designed spatial pyramid pooling can significantly improve the detection performance of the model. We suggested a spatial pyramid pooling method called SPPEPSA that combines partial self-attention in the backbone network of the model. Spatial pyramid pooling (SPP) divides feature maps into grids of varying scales, pooling features across scales to create a multi-scale feature representation [39]. By utilizing MaxPooling with different window sizes, like 1 \(\times\) 1, 3 \(\times\) 3, and 5 \(\times\) 5, SPP enables the network to extract features at diverse scales, facilitating the detection of targets of different sizes. This pooling technique segments images into regions of different sizes, pooling features within each region to capture information across scales. MaxPooling, a common method in SPP, operates on inputs (N, C, H\({}_{\text{in}}\), W\({}_{\text{in}}\)) and outputs (N, C, H\({}_{\text{out}}\), W\({}_{\text{out}}\)), per Equations (1) and (2) as follows, for output shape calculation:  
\[H_{out}=\left\lfloor\frac{H_{in}+2\times P[0]-D[0]\times(K[0]-1)-1}{S[0]}+1\right\rfloor \tag{1}\]  
\[W_{out}=\left\lfloor\frac{W_{in}+2\times P[1]-D[1]\times(K[1]-1)-1}{S[1]}+1\right\rfloor \tag{2}\]  
In these equations, the following parameters are defined: S[i] represents the stride, K[i] denotes the kernel size, P[i] stands for padding, and D[i] refers to dilation. Maxpooling involves sliding fixed-sized windows over input feature maps, selecting the maximum value within each window to generate the output. This method preserves significant features, maintaining spatial key feature positions in the image and enhancing model invariance and robustness. Figure 2: Network architecture of CIHD-YOLO. While spatial pyramid pooling algorithms have excelled in multi-scale object detection tasks [26; 27; 40], distinguishing human bodies from complex backgrounds in indoor settings remains a challenge. The SPPEPSA model combines spatial pyramid pooling with self-attention mechanisms to enhance multi-scale human detection in indoor environments, as depicted in Figure 3. Spatial pyramid pooling captures multi-scale features, while self-attention mechanisms enable better feature utilization, enhancing human target recognition accuracy. Partial self-attention dynamically assigns weights to each feature by learning the interrelationships between features, so that the model can focus on the most relevant features, thus greatly improving the multi-scale detection capability. Self-attention can capture the dependency relationships between different elements in the input sequence by learning the correlations between them, which helps improve the performance of the model in sequence tasks. It first calculates the attention distribution of all input information and then calculates the attention value based on the attention distribution. For the input feature information \(\mathbf{X}\), the key-value pair can be used to represent the N pixel information it contains, as follows: \(\mathbf{X}=(\mathbf{K},\mathbf{V})=[(\mathbf{k}_{1},\mathbf{v}_{1}),(\mathbf{ k}_{2},\mathbf{v}_{2}),\ldots,(\mathbf{k}_{N},\mathbf{v}_{N}]\). A query vector \(\mathbf{q}\) is now given to calculate the attention distribution for all input information.