# SAFP-YOLO: Enhanced Object Detection Speed Using Spatial Attention-Based Filter Pruning
## 5 Conclusions  
Although accurate object detection is crucial for general applications, fast object detection is also important for many real-time applications, such as 24-hour surveillance and autonomous driving. In this study, a method was proposed to improve the execution speed of a one-stage YOLO detector using SAFP. In general, attention mechanisms have been widely used to improve the accuracy of deep learning models, whereas pruning techniques have been used to improve their execution speed. In the proposed SAFP method, a spatial attention mechanism was used to improve the execution speed of YOLO by evaluating the importance of each filter and pruning the unimportant filters. That is, the feature maps were first compared with before and after spatial attention, and then the unimportant filters of YOLO were pruned based on this comparison of feature maps. Because spatial attention emphasized the target locations in a training image, the importance of each YOLO filter was evaluated by checking the changes in the feature map values at the target locations.  
The proposed method was applied to YOLOv4 and YOLOv7 to demonstrate its effectiveness. Using the vehicle dataset, the proposed method with both CBAM and CA improved the execution speed of YOLOv4 from 3.9 FPS to 20.9 FPS on a low-cost embedded board, TX-2, with acceptable accuracy and thus improved the integrated performance (= accuracy \(\times\) speed) from 304.6 to 1517.3. Using the pig dataset, the proposed method with CBAM and CA improved the execution speed of YOLOv7 from 3.8 FPS to 20.0 FPS on a low-cost embedded board, TX-2, with acceptable accuracy and thus improved the integrated performance from 334.0 to 1624.0. For the pig dataset, there were performance improvements of 78.2%@19.2 FPS (TinyYOLOv4) to 72.3%@52.9 FPS and 81.9%@18.3 FPS (TinyYOLOv7) to 75.8%@50.7 FPS, which is confirmed to satisfy real-time object detection using tiny detection models. In other words, the proposed method demonstrated superior overall performance compared to the baseline in all aspects, including two datasets (pig and vehicle), two attention mechanisms (CBAM and CA), two detection models (YOLOv4 and YOLOv7), and two model sizes (medium and tiny). Furthermore, it significantly outperformed the conventional pruning techniques (magnitude- and randomness-based) in terms of accuracy. Also, note that the proposed method can also be applied to other model compression techniques [47], such as quantization.  
[PERSON] and [PERSON] conceptualized and designed the experiments; [PERSON], [PERSON], [PERSON], [PERSON], and [PERSON] designed and implemented the detection system; [PERSON] and [PERSON] validated the proposed method; [PERSON] and [PERSON] wrote the paper. All authors have read and agreed to the published version of the manuscript.  
This work was the result of a local government-university cooperation-based regional innovation project (2021 RJS-004), carried out with the support of the Korea Research Foundation with the funding of the Ministry of Education in 2021 and the National Research Foundation of Korea (NRF) grant with funding from the Korea government (MSIT) (2022R1F1A1062775).  
Not applicable.  
The authors declare no conflict of interest.