Research on Anti-UAV Target Detection Algorithm Based on YOLOv5s-AntiUAV

With the expanding applications of unmanned aerial vehicles (UAVs), unauthorized flights, often termed “black flights,” pose significant threats to public safety. Detecting intrusive UAVs in complex flight environments, especially small targets, remains challenging due to issues like false positives and false negatives. Traditional methods, such as radar, audio, or radio frequency detection, struggle with real-time feature extraction, while deep learning approaches, though capable of multi-scale feature extraction, still face difficulties with scale variations and cluttered backgrounds. To address these problems, we propose an anti-UAV target detection algorithm based on YOLOv5s-AntiUAV. Our improvements enhance feature extraction, maintain computational efficiency, and boost performance for small targets in low-resolution images, making it robust for anti-UAV applications. This paper details our methodology, experiments, and results, demonstrating the algorithm’s effectiveness through extensive testing on custom and public datasets.

In recent years, UAVs have become ubiquitous in urban management and civilian sectors, but their misuse leads to security risks. Real-time detection of UAVs in dynamic environments is critical, yet complex backgrounds, occlusions, and scale changes hinder accuracy. Existing deep learning models, like YOLO variants, offer speed but often miss small targets. We focus on improving YOLOv5s by integrating advanced modules to tackle these challenges. Our work contributes to the anti-UAV field by enhancing detection precision and adaptability, ensuring reliable performance in diverse scenarios.

Our anti-UAV algorithm builds upon YOLOv5s, incorporating three key modifications: the Slim-Neck paradigm with deep hyperparameter convolution, SPD-Conv modules, and an Alpha-CIoU loss function. These changes aim to balance accuracy and speed, improve small-target detection in low-resolution images, and increase robustness. Below, we elaborate on each component, supported by formulas and tables to summarize our approach.

First, we introduce the Slim-Neck paradigm combined with deep hyperparameter convolution to enhance feature extraction while maintaining computational efficiency. Traditional CNNs may lose semantic information when compressing spatial and channel dimensions. The Slim-Neck paradigm uses a lightweight convolution module called GSConv, which preserves hidden connections between channels with lower time complexity. The time complexity for GSConv is given by:

$$T_{GSConv} = O\left[W \cdot H \cdot U_1 \cdot U_2 \cdot \frac{C_2}{2} (C_1 + 1)\right]$$

where \(O\) denotes time complexity, \(W\) and \(H\) are the width and height of the output feature map, \(U_1 \cdot U_2\) is the convolution kernel size, \(C_1\) is the number of channels for each kernel and input feature map, and \(C_2\) is the number of output channels. GSConv aggregates features efficiently by concatenating and shuffling outputs from standard and depthwise convolutions. We integrate this with a cross-stage partial network module, VoV-GSCSP, to simplify the structure and speed up inference.

To further boost performance, we replace some standard convolutions with deep hyperparameter convolution (DO-Conv) modules. DO-Conv uses additional learnable parameters to expand the expressive power of convolution operations. Unlike traditional convolutions, it applies depthwise convolution independently to input channels, capturing spatial information while keeping computational costs low. The output of DO-Conv is expressed as \(O = W * (D \cdot P)\), where \(D\) is the depthwise kernel, \(P\) is the input feature, and \(W\) is the regular convolution kernel. This enhances feature extraction for anti-UAV tasks without compromising efficiency.

Second, we incorporate SPD-Conv modules into both the backbone and neck networks to improve detection of small targets in low-resolution images. Standard CNNs often lose critical details when using strided convolutions or pooling layers, which is detrimental for small UAVs. SPD-Conv replaces these operations with a space-to-depth module that downsamples feature maps by a factor \(l\) and concatenates sub-features along the channel dimension. Given an intermediate feature map \(V\) of size \(X \times X \times C_1\), the extracted sub-feature maps are:

$$
\begin{aligned}
f(0,0) &= W[0:X:l, 0:X:l] \\
f(1,0) &= W[1:X:l, 0:X:l] \\
&\vdots \\
f(l-1,1) &= W[l-1:X:l, 0:X:l] \\
&\vdots \\
f(l-1,l-1) &= W[l-1:X:l, l-1:X:l]
\end{aligned}
$$

These are concatenated to form a feature map \(W’\) with reduced spatial dimensions but increased channels, followed by a convolution layer with stride 1 to retain fine-grained details. This prevents information loss and enhances performance for small anti-UAV targets in blurry or low-resolution scenarios.

Third, we optimize the loss function by replacing CIoU with Alpha-CIoU to improve generalization. CIoU loss, used in YOLOv5s, considers overlap, center distance, and aspect ratio but may underperform for small targets due to smaller overlap areas and larger normalization terms. Alpha-CIoU introduces a hyperparameter \(\alpha\) to balance overlapping and non-overlapping parts, giving more weight to small targets. The loss is defined as:

$$
L_{\alpha-CIoU} = 1 – R_{\alpha}^{IoU} + \frac{\rho^{2\alpha}(b, b^{gt}) + (\beta \nu)^{\alpha}}{c^{2\alpha}}
$$

where \(\beta = \frac{\nu}{(\alpha – R_{IoU}) + \nu}\) and \(\nu = \frac{4}{\pi^2} \left( \arctan \frac{w^{gt}}{h^{gt}} – \arctan \frac{w}{h} \right)^2\). Here, \(R_{IoU}\) is the intersection over union between predicted and ground truth boxes, \(b\) and \(b^{gt}\) are center points, \(\rho\) is the Euclidean distance, \(w\) and \(h\) are widths and heights, and \(c\) is the diagonal length of the minimal enclosing box. This adjustment enhances learning for small anti-UAV targets and improves localization accuracy.

We evaluate our algorithm through comprehensive experiments. Our dataset, Anti-UAV, combines a custom dataset Our-Anti-UAV (1,732 images) with the public DUT-Anti-UAV dataset (6,000 images), totaling 7,732 images. We split it 7:3 into training and validation sets. The dataset includes various UAV scales and resolutions, with a focus on small targets in low-resolution images, as shown in the analysis below. We define small targets as those smaller than 32×32 pixels, medium targets between 32×32 and 96×96 pixels, and large targets above 96×96 pixels. Low-resolution images are below 720×640 pixels. The distribution highlights the prevalence of small targets in low-resolution settings, making it suitable for anti-UAV testing.

Our experimental setup uses a Windows 10 system with an Intel Core i7-8700K CPU, NVIDIA GeForce RTX 2080 Ti GPU, 32 GB RAM, and 12 GB VRAM. We implement models in PyTorch 1.12.1 with CUDA 11.3 and Python 3.8. Evaluation metrics include detection speed (FPS), precision (P), recall (R), average precision (AP), and mean average precision (mAP) at thresholds of 0.5 and 0.5:0.95.

We conduct ablation studies to assess each improvement’s impact. The baseline is YOLOv5s (denoted O), with additions: I for SPD-Conv, II for Alpha-CIoU, and III for Slim-Neck with DO-Conv. Results are summarized in Table 1.

Algorithm I II III P (%) R (%) mAP@0.5 (%) mAP@0.5:0.95 (%) FPS (frames/s)
O × × × 97.1 87.4 91.2 58.1 50.0
A √ × × 97.5 87.2 92.3 59.1 38.6
B × √ × 97.1 88.9 92.7 59.0 49.2
C × × √ 97.1 88.0 92.1 58.5 37.1
D √ √ × 95.7 87.5 91.4 58.8 48.3
E √ × √ 96.5 88.2 92.4 59.1 38.6
F × √ √ 96.5 87.2 91.5 58.5 49.4
G (YOLOv5s-AntiUAV) √ √ √ 95.3 88.5 92.3 59.0 33.4

Table 1 shows that all modules improve mAP over the baseline, though with some trade-offs in FPS. Our full model (G) achieves a balance, enhancing anti-UAV detection accuracy.

We compare YOLOv5s-AntiUAV with classical algorithms like SSD and Faster R-CNN on the Anti-UAV dataset. Metrics include parameter count, FPS, and mAP@0.5, as in Table 2.

Algorithm Parameters FPS (frames/s) mAP@0.5 (%)
YOLOv5s 6.7 × 10⁶ 50.0 91.2
SSD 23.75 × 10⁶ 24.9 80.2
Faster R-CNN 41.12 × 10⁶ 13.0 87.4
YOLOv5s-AntiUAV 8.56 × 10⁶ 33.4 92.3

Our algorithm reduces parameters compared to SSD and Faster R-CNN while increasing mAP@0.5 by 12.1 and 4.9 percentage points, respectively. Against YOLOv5s, we gain 1.1 percentage points in mAP@0.5, demonstrating superior anti-UAV performance despite a lower FPS, still meeting real-time needs.

For loss function analysis, we test Alpha-CIoU against others like SIoU, WIoU, and Focal_EIoU. Results in Table 3 confirm Alpha-CIoU’s superiority for anti-UAV tasks.

Loss Function P (%) R (%) mAP@0.5 (%) mAP@0.5:0.95 (%)
CIoU 97.1 87.4 91.2 58.1
SIoU 95.8 87.8 91.1 58.2
WIoU 96.1 87.5 91.3 58.2
Focal_EIoU 96.9 85.9 91.1 58.0
Alpha-CIoU 97.1 88.9 92.7 59.0

Alpha-CIoU excels across all metrics, highlighting its effectiveness for small target detection in anti-UAV scenarios.

To validate generalizability, we perform transfer learning on the VisDrone2019 dataset, which includes various object classes like pedestrians, cars, and buses. After 300 training epochs, our algorithm outperforms YOLOv5s, as shown in Table 4.

Algorithm AP for Classes (%) mAP@0.5 (%)
YOLOv5s Pedestrian: 40.2, People: 32.5, Bicycle: 12.4, Car: 74.5, Van: 37.4, Truck: 32.2, Tricycle: 21.4, Awning-Tricycle: 11.5, Bus: 47.9, Motor: 38.7 34.9
YOLOv5s-AntiUAV Pedestrian: 45.6, People: 35.9, Bicycle: 16.5, Car: 79.5, Van: 43.3, Truck: 38.1, Tricycle: 23.4, Awning-Tricycle: 14.0, Bus: 53.8, Motor: 43.7 39.4

Our algorithm improves mAP@0.5 by 4.5 percentage points, with higher AP for each class, proving its robustness and versatility for small target detection beyond anti-UAV applications.

In conclusion, we propose YOLOv5s-AntiUAV, an enhanced algorithm for detecting intrusive UAVs in complex environments. By integrating Slim-Neck with deep hyperparameter convolution, SPD-Conv modules, and Alpha-CIoU loss, we achieve better feature extraction, reduced information loss, and improved generalization. Experiments on the Anti-UAV dataset show mAP@0.5 of 92.3%, outperforming baseline and classical models while maintaining real-time capability. Transfer learning on VisDrone2019 confirms broader applicability. Future work could focus on optimizing speed further and testing in more diverse anti-UAV scenarios. Our contributions advance the field of anti-UAV target detection, offering a practical solution for public safety.

Scroll to Top