Since UAVs usually fly at higher altitudes, resulting in a more significant proportion of small targets after imaging, this poses a challenge to the target detection algorithm at this stage; in addition, the high-speed flight of UAVs causes a sense of blurring on the detected objects, which leads to difficulties in target feature extraction. To address the two problems presented above, we propose a UAV target detection algorithm based on improved YOLOv8. First, the small target detection structure (STC) is embedded in the network, which acts as a bridge between shallow and deep features to improve the collection of semantic information of small targets and enhance detection accuracy. Second, using the feature of global information of UAV imaging-focused targets, the global attention GAM is introduced to the bottom layer of YOLOv8m's backbone to prevent the loss of image feature information during sampling and thus increase the algorithm's detection performance by feeding back feature information of different dimension. The modified model effectively increases the detection of tiny targets with an mAP value of 39.3%, which is 4.4% higher than the baseline approach, according to experimental results on the VisDrone2021 dataset, and outperforms mainstream algorithms such as SSD and YOLO series, effectively increasing the detection performance of UAVs for small targets.INDEX TERMS UAV target detection; Global attention mechanism; Small target detection