The proliferation of Unmanned Aerial Vehicles (UAVs) has introduced significant societal benefits alongside profound security challenges. Their potential for misuse in unauthorized surveillance, smuggling, and even attacks on critical infrastructure necessitates robust countermeasures. Traditional anti-UAV systems often rely on specialized military-grade hardware like radar or radio frequency sensors, which face legislative and deployment hurdles in civilian contexts. Furthermore, these systems frequently lack efficient mechanisms for the simultaneous detection and visual identification of multiple small UAV targets against cluttered backgrounds. To address these gaps, this research explores a vision-based approach, proposing an enhanced deep learning model for real-time, multi-target UAV recognition, a critical component for effective and deployable civilian anti-UAV solutions.

Deep learning, particularly convolutional neural networks (CNNs), has revolutionized object detection by learning hierarchical feature representations directly from data. Among state-of-the-art detectors, the YOLO (You Only Look Once) family is renowned for its superior speed-accuracy trade-off, making it ideal for real-time applications like anti-UAV monitoring. YOLOv7, as one of the latest iterations, introduces architectural refinements such as the Efficient Layer Aggregation Network (ELAN) and planned re-parameterized convolutions, achieving notable performance. However, when applied directly to the challenging task of detecting distant, small UAVs in aerial imagery, baseline YOLOv7 exhibits limitations including limited feature reuse in its backbone, insufficient noise suppression during feature fusion, and a higher miss rate for diminutive targets. Our work systematically modifies the YOLOv7 architecture to overcome these shortcomings, tailoring it specifically for the demanding requirements of anti-UAV target recognition.
Principles of the Baseline YOLOv7 Algorithm
YOLOv7 is a single-stage anchor-based detector comprising three primary components: Input, Backbone, and Head (which integrates the feature fusion neck and prediction layers). The network processes input images at a resolution of 640×640×3. The Backbone is responsible for hierarchical feature extraction and consists of approximately 50 convolutional layers organized with CBS modules (Conv+BN+SiLU), MP (Max Pooling) layers, and ELAN modules.
The MP layer employs a dual down-sampling pathway to preserve information: one branch applies max pooling, focusing on the most salient local features, while the other uses a convolutional stride of 2. This design helps maintain a balance between spatial resolution reduction and feature preservation. The outputs are concatenated and processed further. The structure of an MP layer is illustrated below:
The ELAN module is a core innovation in YOLOv7, designed for efficient gradient flow and feature aggregation. It features a two-branch structure. The upper branch adjusts channel dimensions via a 1×1 convolution. The lower branch first modifies channels with a 1×1 convolution and then passes through a stack of four CBS modules for deeper feature extraction. The features from both branches are finally fused through concatenation. This design controls the shortest and longest gradient paths, enhancing learning efficiency. The ELAN structure is shown:
Following the backbone, features pass through the SPPCSPC module. The Spatial Pyramid Pooling (SPP) component pools features at multiple scales (e.g., 5×5, 9×9, 13×13) to increase the receptive field without losing resolution, enabling the network to better understand multi-scale context—a vital capability for anti-UAV tasks where object scale varies significantly with distance. The Cross Stage Partial Connection (CSP) mitigates the vanishing gradient problem in deep networks by creating partial connections between stages, allowing gradients to flow more freely during training. The combined SPPCSPC module structure is depicted:
The Head section performs multi-scale feature fusion via a Path Aggregation Network (PANet) inspired structure and makes final bounding box and class predictions at three different scales. The overall architecture is illustrated.
Proposed Improvements to YOLOv7 for Anti-UAV Recognition
To enhance YOLOv7’s performance specifically for small, distant UAV targets in complex aerial environments, we introduce three key modifications targeting the Backbone, the feature fusion path, and the detection Head.
1. Feature Reuse Based on Concatenation in Backbone
While the baseline YOLOv7 backbone is efficient, its sequential processing can lead to information loss, especially for fine-grained details crucial for small UAV detection. Issues include a limited effective receptive field in early layers and constrained reuse of low-level features (e.g., edges, corners) in deeper layers. This is problematic for anti-UAV systems that must identify small, blurry objects where high-resolution spatial details are essential.
We introduce explicit feature reuse via dense concatenation connections within the backbone. The core operation is the concatenate (Concat) function, which joins feature maps from different layers along the channel dimension. Given two feature maps $x_1 \in \mathbb{R}^{h_1 \times w_1 \times c_1}$ and $x_2 \in \mathbb{R}^{h_2 \times w_2 \times c_2}$, the concatenation is defined as:
$$ \text{Concat}(x_1, x_2) = [x_1; x_2] \in \mathbb{R}^{h_1 \times w_1 \times (c_1+c_2)} $$
where $[x_1; x_2]$ denotes stacking along the depth axis. We strategically add connections that bypass several layers, feeding higher-resolution, lower-level feature maps directly forward to be concatenated with deeper, more semantic features. This provides subsequent layers with a richer set of features encompassing both detailed spatial information and high-level context, significantly improving the network’s ability to localize and recognize small UAV targets for anti-UAV applications. The modified backbone structure with these concatenation links is shown.
2. ELAN with Attention Mechanism for Feature Fusion
The original ELAN module effectively aggregates features but lacks a mechanism to dynamically weigh the importance of different channels or spatial locations. In cluttered anti-UAV scenarios (e.g., UAVs against cloudy skies or urban backgrounds), not all extracted features are equally relevant; some may represent noise or background clutter.
We integrate a feature recalibration layer, specifically a channel attention mechanism, into the ELAN design, creating an A-ELAN (Attentive ELAN) module. This mechanism learns to emphasize informative features and suppress less useful ones. The process can be summarized by an attention weight computation. For an input feature map, a compact feature descriptor is first created using global average pooling. This descriptor then passes through a small network (e.g., two fully-connected layers with a non-linearity) to produce a channel-wise weight vector $\alpha = \{\alpha_1, \alpha_2, …, \alpha_C\}$, where $C$ is the number of channels. The weights are computed via a softmax function, often over elements in an interaction context:
$$ \alpha_{i,j} = \frac{\exp(e_{i,j})}{\sum_{k=1}^{N} \exp(e_{i,k})} $$
where $e_{i,j}$ is a learned compatibility score, often computed as $e_{i,j} = f_{att}(x_i, x_j)$. The original features are then scaled by these weights: $\tilde{x}_c = \alpha_c \cdot x_c$. This simple yet powerful gating mechanism allows the network to adaptively refine its feature maps during fusion, enhancing the discrimination power of the features passed to the detection head—a critical enhancement for reliable anti-UAV identification amidst distractions. The structure of the improved A-ELAN module is presented.
3. Detection Head with Dilated Convolution and Residual Theory
The detection head in YOLOv7 is responsible for making final predictions on multi-scale feature maps. For very small UAVs, the feature representations can be weak and occupy only a few pixels. To capture finer context around these tiny objects without excessively downsampling, we modify the head using dilated convolutions and reinforce it with residual connections.
Dilated Convolutions: Also known as atrous convolutions, they insert “holes” (zeros) between kernel elements, effectively enlarging the receptive field without increasing the number of parameters or losing resolution. The operation for a dilated convolution is:
$$ y_{i,j,k} = \sum_{p,q} w_{p,q,k} \cdot x_{i + p \cdot d, j + q \cdot d} $$
where $d$ is the dilation rate. A rate of $d=1$ corresponds to a standard convolution. We employ parallel convolutional branches with different dilation rates (e.g., 1, 3, 5) within the head to capture multi-scale contextual information around potential UAV locations, which is vital for distinguishing them from small birds or other false positives.
Residual Connections: To ease gradient flow and facilitate the learning of identity mappings (important when fine details must be preserved), we incorporate residual/skip connections within the head’s processing blocks. A residual block computes its output as:
$$ y = F(x, W) + x $$
where $F(x, W)$ represents the transformation learned by the block’s layers (e.g., dilated convolutions, batch normalization, activation). This helps prevent degradation in performance when the network depth is effectively increased and ensures that critical low-level features from the backbone and neck are not washed out during the final prediction stages.
The combined module, termed the D-Res Head (Dilated-Residual Head), processes input features through multiple parallel dilated convolution paths, applies batch normalization and activation, and then merges them. A final residual connection adds the processed features to the original input, ensuring feature integrity crucial for small target detection in anti-UAV systems. The detailed architecture of this improved head is shown.
Experimental Results and Analysis
Dataset and Preprocessing
To train and evaluate our improved anti-UAV model, we utilized a diverse dataset comprising images and annotations collected from 6 different UAV models under various conditions. The data was gathered across 12 locations, encompassing three primary scenarios: cloudy, sunny, and evening. UAVs were flown at different altitudes and distances ranging from 30 to 100 meters. To ensure model robustness and prevent overfitting on sequential frames, we randomly sampled 3,488 frames from the original video sequences for our training and validation sets. The data was split in an 8:2 ratio for training and validation, respectively. Dataset characteristics are summarized below:
| Component | Description |
|---|---|
| Source UAV Models | 6 different types (e.g., DJI Phantom, Mavic) |
| Total Initial Frames | 20,924 |
| Selected Frames | 3,488 |
| Scenarios | Cloudy, Sunny, Evening |
| Altitude Range | 30m – 100m |
| Train/Val Split | ~2,790 / ~698 (80%/20%) |
| Augmentation | Mosaic, Random affine |
Training Configuration
Both the baseline YOLOv7 and our improved model were trained under identical conditions for a fair comparison. Key hyperparameters were set as follows: number of epochs: 130; batch size: 20; initial learning rate: 0.001; optimizer: Adam (momentum=0.937); learning rate scheduler: Cosine Annealing. We employed the Mosaic data augmentation technique to enhance the diversity and scale invariance of the training data, a crucial step for generalizable anti-UAV performance. The loss function combined CIoU loss for bounding box regression and Binary Cross-Entropy (BCE) loss for objectness and classification confidence. The training loss curves for both models converged effectively, as shown in the comparative graph, with the improved model showing stable optimization behavior.
Ablation Study and Performance Comparison
We conducted an ablation study to evaluate the contribution of each proposed module to the overall anti-UAV recognition performance. The results, measured by Precision (P), Recall (R), and mean Average Precision at IoU=0.5 (mAP@0.5), are presented below.
| Model Variant | Precision (P) | Recall (R) | mAP@0.5 | Notes |
|---|---|---|---|---|
| YOLOv7 (Origin) | 90.9% | 80.6% | 82.5% | Baseline |
| + Feature Reuse (Impro1) | 90.0% | 75.5% | 83.1% | +0.6% mAP |
| + A-ELAN (Impro2) | 89.2% | 71.9% | 84.1% | +1.6% mAP |
| + D-Res Head (Impro3) [Ours] | 87.6% | 76.0% | 85.3% | +2.8% mAP |
The results demonstrate a clear positive trend. While Precision and Recall show some variation, the key metric mAP@0.5 increases consistently with each addition, culminating in a 2.8% improvement for our full model. The slight dip in Precision/Recall for some variants can be attributed to the model becoming more sensitive to challenging, previously missed small UAVs (increasing Recall potential but also the chance for false positives initially), while the mAP increase confirms a superior overall detection capability. Our final model achieves the best balance, significantly boosting mAP while recovering Recall compared to the intermediate variant.
We further compared our improved YOLOv7 model against other prominent object detectors trained and tested on the same anti-UAV dataset. The comparison highlights the effectiveness of our approach within the landscape of object detection solutions.
| Model | Precision (P) | Recall (R) | mAP@0.5 | Remarks |
|---|---|---|---|---|
| Faster R-CNN | 78.4% | 82.4% | 78.0% | Two-stage, accurate but slower |
| SSD | 74.3% | 62.2% | 65.6% | Struggles with small targets |
| YOLOv5 | 80.2% | 79.2% | 79.2% | Strong baseline |
| YOLOv7 (Origin) | 90.9% | 80.6% | 82.5% | Previous SOTA in YOLO series |
| Ours (Improved YOLOv7) | 87.6% | 76.0% | 85.3% | Best mAP, robust to small UAVs |
Our model achieves the highest mAP@0.5, outperforming both two-stage (Faster R-CNN) and other single-stage detectors (SSD, YOLOv5). Crucially, it surpasses the baseline YOLOv7 by 2.8%, validating the efficacy of our architectural modifications for the anti-UAV task.
Qualitative Analysis
Qualitative results strongly support the quantitative findings. In test scenarios featuring small, distant UAVs, the baseline YOLOv7 often failed to generate detection bounding boxes or produced low-confidence predictions that were filtered out. In contrast, our improved model successfully identified and localized these challenging small UAV targets with high confidence. The comparison is visually presented, showing side-by-side results where the original model misses UAVs that our model correctly detects. This visual evidence confirms that our enhancements directly address the core problem of small target miss-detection, a critical advancement for practical anti-UAV surveillance systems.
Conclusion
This research addressed the critical need for effective civilian-deployable anti-UAV technology by developing an enhanced visual detection system based on deep learning. We identified specific limitations in the state-of-the-art YOLOv7 detector when applied to recognizing small, distant UAVs in aerial imagery. To overcome these, we proposed three targeted architectural improvements: 1) Feature Reuse via Concatenation in the backbone to preserve fine-grained details, 2) an ELAN module integrated with a Channel Attention mechanism (A-ELAN) for adaptive feature recalibration, and 3) a Detection Head incorporating Dilated Convolutions and Residual connections (D-Res Head) to capture multi-scale context and maintain feature integrity for small objects.
Comprehensive experiments on a diverse UAV dataset demonstrate that our modified model achieves a mean Average Precision (mAP@0.5) of 85.3%, a significant 2.8% improvement over the baseline YOLOv7. The ablation study confirms the cumulative contribution of each component. More importantly, qualitative analysis shows a marked reduction in the miss rate for small UAV targets, which is the primary failure mode for vision-based anti-UAV systems. The proposed model strikes an effective balance between accuracy and speed, making it a suitable core component for real-time, multi-target anti-UAV monitoring solutions. Future work may involve integrating temporal information from video streams and optimizing the model for deployment on edge-computing platforms to further enhance the practicality of deep learning-based anti-UAV defenses.
