### Real-time dense small object detection algorithm for UAV based on improved YOLOv5

• Received:2022-03-04 Revised:2022-05-06 Online:2022-05-09 Published:2022-05-09

Abstract: Real-time UAV object detection has a wide application prospect. Compared with natural scene images, the background of UAV aerial images is more complex and there are a large number of dense small targets, which puts forward higher re-quirements on the detection network. Under the precursor of ensuring the real-time object detection, a YOLOv5-based UAV real-time dense small object detection algorithm is proposed for the problem of low accuracy of dense small object detection under UAV view. Firstly, the spatial attention module (SAM) is combined with the channel attention module (CAM) to improve the fully connected layer after feature compression in CAM to reduce the computational effort and im-prove the accuracy. In addition, the connection structure of CAM and SAM is changed to improve the spatial dimensional feature capture capability. In summary, a spatial-channel attention module (SCAM) is proposed to improve the model's attention to small target aggregation regions in the feature map. Secondly, a new SCAM-based attentional feature fusion module (SC-AFF) is proposed to enhance the feature fusion efficiency of small targets by adaptively assigning attentional weights according to feature maps of different scales. Finally, a new self-attentive backbone network is designed, the Transformer module is introduced in the backbone network, and the SC-AFF module is used to improve the original fea-ture fusion at the residual connections to better capture global information and rich contextual information while improving the model's ability to capture information of different dimensions and improve the feature extraction of dense small targets in complex contexts. Experiments are conducted on the VisDrone2021 dataset, and the effects of different network scale parameters and different input resolutions on the detection accuracy and speed of YOLOv5 are first investigated, and the analysis concludes that YOLOv5s is more suitable as a benchmark model for UAV real-time object detection. Under YOLOv5s benchmark, the improved model improves mAP50 by 6.4% and mAP75 by 5.8%, and the FPS for high-resolution images can reach 46. The mAP50 of the model trained at an input resolution of 1504×1504 can reach 54.5%, which is 11.5% better than YOLOv4. The accuracy is improved while the detection speed remains at 46 FPS, which is more suitable for real-time UAV object detection in dense small target scenarios.