# Pedestrian Detection Based on Feature Enhancement in Complex Scenes
## 3 PT-YOLO Pedestrian Detection Network
### Head: Detection  
The head of the pedestrian detection network PT-YOLO is mainly responsible for generating the predicted bounding box during the detection process, as well as classifying and adjusting the position of the bounding box. Our method uses 20 \(\times\) 20, 40 \(\times\) 40, and 80 \(\times\) 80 detection heads to detect pedestrians of different sizes. In summary, the output of the pedestrian detection network PT-YOLO can provide information such as the locations, sizes, and categories of pedestrians in the image.  
The YOLOv5 network employs complete intersection over union (CIoU) [35] as the default loss function for bounding box regression. The loss function consists of three components: classification loss, confidence loss and regression loss, which primarily consider three parameters: the overlap area, center point distance and aspect ratio. \(c\) represents the diagonal distance of the minimum closure area that contains both the prediction box and the ground truth, and \(\rho\) represents the distance between the two center points of the prediction box and ground truth. The formula is as follows:  
\[\left\{\begin{aligned} v=\frac{4}{\pi}\left(arctan\frac{w^{gt}}{h^{ gt}}-arctan\frac{w}{h}\right)^{2}\\ \alpha=\frac{w}{(1-IoU)+V}\\ Loss_{CIoU}=1-IOU+\frac{\rho^{2}\left(b,bgt\right)}{c^{2}}+\alpha \end{aligned}\right. \tag{2}\]  
where \(w^{gt}/h^{gt}\) represents the aspect ratio of the real frame, and \(w/h\) represents the aspect ratio of the predicted frame. \(b\) and \(b^{gt}\) represent the center points of the prediction box and ground truth box, respectively. The weight parameter is denoted as \(\alpha\), and the similarity of aspect ratios is measured using a parameter labeled as \(v\). However, the CIoU aspect ratio describes relative values, so there is a certain ambiguity. Meanwhile, CIoU does not consider the balance of difficult and easy samples, which leads to inaccurate prediction frames and thus inaccurate or missed detection results. Therefore, in this paper, the WIoU [36] loss function with a dynamic non-monotonic focusing mechanism is introduced as a bounding box regression loss calculation to solve the sample imbalance problem. The formula is as follows:  
Figure 7: Structure of the modules. (**a**) standard convolutional module; (**b**) coordconv module.  
\[\left\{\begin{matrix}L_{WlloU}=\gamma exp\left(\frac{\left(x-x_{gt}\right)^{2}+ \left(y-y_{gt}\right)^{2}}{\left(y_{gt}^{2}+H_{t}^{2}\right)^{2}}\right)L_{ IoU}\\ L_{IoU}=1-\frac{\left(y_{gt}\right)^{2}}{\left(y_{gt}^{2}+H_{t}^{2}\right)^{2}}\\ \gamma=\frac{\beta}{\delta\omega^{2}-\beta}\\ \beta=\frac{L_{IoU}}{L_{IoU}}\in[0,\infty)\end{matrix}\right. \tag{3}\]  
In the equation, \(x\) and \(y\) represent the horizontal and vertical coordinates of the centre of the prediction frame, and \(w\) and \(h\) represent the width and height of the prediction frame. \(x_{gt}\) and \(y_{gt}\) represent the horizontal and vertical coordinates of the center point of the real frame, and \(\omega_{gt}\) and \(h_{gt}\) represent the width and height of the real frame. \(W_{g}\) and \(H_{g}\) are the sizes of the smallest the bounding box. \(W_{i}\) and \(H_{i}\) are the width and height of the area where the prediction box overlaps the real box. \(L_{IoU}\) denotes the monotonic focusing factor, \(\overline{L_{IoU}}\) denotes the average of the degree of overlap between the target frame and the predicted frame, \(\gamma\) denotes the non-monotonic focusing factor, \(\beta\) is the outlier, and \(\alpha\) and \(\delta\) are hyper-parameters.