SPA-DETR: An Enhanced RT-DETR with Spatial-Preserving Attention and Adaptive Loss for UAV Spectrogram Signal Detection
Conghao Fu, Lu Xu, Yijia ZhangRapid detection of unauthorized unmanned aerial vehicles (UAVs) via radio frequency (RF) spectrograms is critical for low-altitude security. However, standard object detectors struggle to locate transient, frequency-hopping UAV signals because their microscopic spatial footprints are easily discarded by conventional lossy downsampling and overwhelmed by complex background noise. To overcome this limitation, we propose SPA-DETR, a custom architecture based on the RT-DETR framework. The core of our design is the Spatial-Preserving Attention (SPA) block, which integrates Space-to-Depth Convolution (SPDConv) with a Parallel Patch-Aware Attention (PPA) module. By replacing traditional pooling mechanisms, the SPA block preserves the spatial details of weak signals without information loss, while the PPA module concurrently filters out ambient background interference. Furthermore, to address the severe foreground–background imbalance in RF spectrograms, we introduce an Adaptive Threshold Focal Loss (ATFL). Operating exclusively during training, ATFL prevents background noise gradients from dominating the learning process, forcing the network to focus on hard-to-detect signal patches without adding computational overhead during inference. Experiments on our public RFUAV dataset validate the approach. SPA-DETR achieves an mAP50:95 of 86.8% and an APS of 85.6%, improving upon the baseline RT-DETR-R18 by 4.9% and 5.2%, respectively. Operating at 235.2 FPS with only 23.74 M parameters, SPA-DETR outperforms contemporary detectors such as YOLOv10m, as well as heavier models like YOLOv8m and RT-DETR-R50, highlighting its efficiency and practical value for real-time low-altitude security applications.