## 3 Methodology
### Pedestrian Detection  
Pedestrian detection is the first step of pedestrian flow statistics algorithm. The algorithm mainly improves from the yolov3 detection network [35]. In order to reduce the computational complexity  
Figure 1: Overall flow chart of the proposed algorithm.  
of the algorithm, the darkent-53 network in the front of the network is replaced by a pruned and compressed VGG network [36], which reduces the computational complexity of the network from 65 Bflops to 39 Bflops. Because the target is pedestrian traffic statistics, too small anchor settings have no effect on improving detection accuracy, so kmeans algorithm is used to re-cluster the size of network anchor. Due to the large scale of the targets in the front-down camera, the last FPN structure of the yolov3 network is removed to reduce the computational complexity. The final computational complexity of the neural network is 34 Bflops. At the same time, the mAP (mean Average Precision) of the detector only reduce 1.61, from 74.49 to 72.88. The final network structure of the algorithm is shown in Figure 2.  
In pedestrian flow statistics, pedestrian targets are very dense, and there is serious occlusion between the targets. The traditional non-maximum suppression (NMS) method can cause a part of the correct detection to be lost while removing redundant detection bounding boxes. So soft-NMS method is used to improve the non-maximum suppression [37]. Unlike the original non-maximum suppression method, as shown in Formula (1), soft-nms method does not directly remove the bounding box whose IOU exceeds the threshold and confidence is lower, but reduces the confidence of the detection box, which makes it more difficult for the correct detection to be removed incorrectly due to the dense targets. In Formula (1), \(d_{i}\) is a detection result with score \(s_{i}\), \(d_{m}\) is another detection result which has higher score than \(d_{i}\), \(N_{i}\) represent the threshold of soft-NMS. As shown in Figure 3, after using soft-NMS, not only the redundant detection results can be correctly removed, but also the missing rate can be reduced.  
\[s_{i}=\begin{cases}s_{i},&IOU(d_{m},d_{i})<N_{i}\\ s_{i}(1-IOU(d_{m},d_{i}),&IOU(d_{m},d_{i})\geq N_{i}\end{cases} \tag{1}\]  
In the front-down cameras, the objects close to the cameras can easily occlude the lower half of the objects farther from the cameras. On this basis, because of the lateral movement of the target, the bounding box of the farther target will change dramatically in height, which is not conducive to the following tracking operation. However, the top position and width of the bounding box will not be affected in such case. Based on this observation, we adjust the shape of bounding boxes by their width and the top position. For the bounding boxes whose aspect ratio are greater than 1:2.5, the heights of them are increased on the basis of fixing the top position and width, so that the aspect ratios are adjusted to 1:2.5. As shown in Figure 4, this scheme effectively reduces the deformation of the bounding box due to occlusion. At the same time, this method improves the positioning accuracy of the real center position of the occluded target, and is more conducive to the final counting task.  
Figure 2: Network structure of detection algorithms. The blue layers are convolutional layers, the red layers are max-pooling layers, and the yellow layers are detection layers.