# Emergency Evacuation Simulation Study Based on Improved YOLOv5s and Anylogic
## 2 Materials and Methods  
### Analysis and Design of the YOLOv5s-SE Algorithm  
The YOLO [20; 21; 22; 23] (You Only Look Once) family of target detection algorithms accomplishes target location and classification by using direct prediction of the target's bounding box, which has the benefit of increasing detection speed. YOLOv5 is an improvement of the YOLO series algorithm [24], YOLOv5 builds on the YOLOv4 target detection algorithm by using auto-scaling, cropping, and mosaic for data enhancement, adding automatic learning of the size of the anchor box. The network structure of YOLOv5 is divided into three parts. The first part is Backbone, whose role is mainly feature extraction; the second part is Neck, whose role is to mix and combine features and pass these features to the prediction; and the third part is Head, responsible for the final prediction and the output of the prediction results. In tests on the official dataset, YOLOv5 has shown some improvement in detection speed and accuracy over YOLOv4, and a nearly 90% reduction in model size compared to YOLOv4 [25]. The YOLOv5 algorithm is divided into YOLOv5s, YOLOv5m, YOLOv5l, and YOLOv5x according to network depth and feature map width from small to large, where the depth of the YOLOv5s model is 1/3 of YOLOv5l and the width of the feature map is 1/2 of YOLOv5l. Since this paper is to achieve the detection of pedestrians under emergency situation conditions, the importance of detection speed is greater than detection accuracy, so YOLOv5s, which has a faster detection speed, is chosen as the object of study in this paper. Although YOLOv5s has a fast detection speed, the detection results for small target groups are not satisfactory. As the YOLOv5s network level continues to deepen, the information extracted at the output becomes increasingly abstract, and the detection of distant pedestrian heads inside the field station becomes increasingly difficult to achieve. Therefore, in order to enhance the accuracy of YOLOv5s for small target group detection, this paper incorporates SENet [26] into the YOLOv5s network structure, and the improved network structure is shown in Figure 1.  
On the input side, YOLOv5s adopts the Mosaic data enhancement technology, which can solve the problem of unsatisfactory training results and model overfitting caused by insufficient sample data to a certain extent. Secondly, it introduces the adaptive anchor frame calculation, which can obtain prediction frames based on predetermined a priori frames during network training. Thirdly, it adds the adaptive image scaling mechanism, which effectively improves the model training. Finally, an adaptive image scaling mechanism is added to effectively improve the model's training speed. In the feature extraction backbone network, YOLOv5s uses the Focus structure and Cross Stage Partial [27] (CSP), and two different CSP: CSP1_X for the feature extraction network and CSP2_X for the feature fusion network. The Neck network layer of YOLOv5s consists of Feature Pyramid Networks [28] (FPN) and Path Aggregation Networks [29] (PAN), which deliver richer semantic and localization information from top to bottom and bottom to top, respectively, and then fuse features from different backbone layers to different FPN and PAN to deliver richer semantic and localization information from top to bottom and bottom to top, respectively. The prediction side of YOLOv5s consists of three detectors corresponding to three different scales of feature maps, large, medium, and small, for target detection, and the output prediction results correspond to target frame coordinates, confidence, and category information, respectively. In YOLOv5s, the SPP [30] (Spatial Pyramid Pooling) module can further extract features by serial pooling to enhance the deep feature representation capability of the backbone network and improve the perceptual field of the model.