A small target unmanned aerial vehicle detection method and device in a complex scene

By constructing a regional-level association graph and a two-layer routing attention mechanism, the accuracy and efficiency issues of small target UAV detection in complex backgrounds are solved, achieving high-efficiency detection results.

CN122336593APending Publication Date: 2026-07-03BEIJING ELECTRONICS SCI & TECH INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610363803.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-24
Publication Date
2026-07-03

Smart Images

  • Figure CN122336593A_ABST
    Figure CN122336593A_ABST
Patent Text Reader

Abstract

This invention discloses a method and apparatus for detecting small-target UAVs in complex scenes, belonging to the fields of computer vision and UAV monitoring technology. By segmenting the input image into coarse-grained regions and constructing a correlation map by selecting highly correlated regions, background noise is filtered out. Fine-grained markers within the regions are integrated and attention is calculated. A two-layer routing attention mechanism is used to dynamically suppress irrelevant backgrounds and enhance local target features, generating an enhanced feature representation that integrates global semantics and local details. Finally, multi-scale feature fusion and a detection head output category and location information. This invention significantly improves the detection accuracy and robustness of small-sized UAV targets in complex backgrounds.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of computer vision and drone monitoring technology, and in particular to a method, apparatus, device, and storage medium for detecting small-target drones in complex scenarios. Background Technology

[0002] In practical applications such as drone inspection and security monitoring, the rapid and accurate detection of small drone targets from complex backgrounds (such as building clusters, forests, and sky clutter) is a crucial and highly challenging task. Although general-purpose target detection frameworks like YOLOv11 have achieved excellent performance on general datasets, their core architecture still exhibits a series of inherent technical flaws when faced with the specific task of "small drone target detection in complex backgrounds," severely limiting detection accuracy and practical efficiency.

[0003] First, modules based on convolutional neural networks (CNNs), such as C3K2, have an inherent limitation of "locality." These modules rely on local convolutional kernels for feature extraction, resulting in a limited receptive field and difficulty in modeling long-distance, cross-regional semantic dependencies in images. When a drone is partially occluded or blended into a complex background, the model can only make inferences based on locally visible fragments, failing to fully understand the overall semantic context of the target. This leads to insufficient ability to identify blurred or incomplete targets, resulting in a significant decrease in detection accuracy.

[0004] Secondly, existing attention modules such as C2PSA suffer from significant computational redundancy. They perform indiscriminate, intensive computation across the entire feature map, while UAV detection images typically contain large areas of irrelevant background. Lacking an intelligent dynamic selection or "routing" mechanism, a large amount of computational resources is wasted on processing background noise. This not only results in unnecessary computational consumption but also easily obscures key target features, leading to missed detections and false positives.

[0005] Finally, while introducing the traditional global multi-head attention mechanism can compensate for the long-range modeling shortcomings of CNNs, its computational complexity is proportional to the square of the input sequence length. When processing high-resolution aerial imagery, this results in huge memory overhead and computational latency, making it difficult for the model to meet the deployment requirements of real-time detection and severely affecting the feasibility of the algorithm on resource-constrained edge devices.

[0006] Therefore, there is an urgent need for a UAV small target detection scheme that can achieve efficient global semantic association, dynamically focus on key areas, and maintain low computational complexity. Summary of the Invention

[0007] The present invention aims to at least partially solve one of the technical problems in the related art.

[0008] To address this, this invention proposes a method for detecting small targets on UAVs in complex scenarios. By constructing a regional-level correlation graph to filter out highly correlated regions and background noise, the method integrates and performs attention calculations on the markers within the regions. Based on a two-layer routing attention mechanism, the method dynamically suppresses the background and enhances target features. Finally, the method outputs target category and location information through multi-scale fusion and a detection head, thereby achieving accurate and efficient detection of small targets on UAVs in complex backgrounds.

[0009] Another objective of this invention is to provide a device for detecting small targets in complex scenarios using unmanned aerial vehicles (UAVs).

[0010] The third objective of this invention is to provide a computer device.

[0011] A fourth objective of this invention is to provide a non-transitory computer-readable storage medium.

[0012] To achieve the above objectives, this invention proposes a method for detecting small targets using unmanned aerial vehicles (UAVs) in complex scenarios, comprising: S1, the input image is segmented into multiple coarse-grained regions of fixed size, the affinity matrix between each region is calculated, and highly correlated regions are selected based on the Top-k strategy to construct a region-level correlation map to filter background noise; S2, perform a label collection operation on the fine-grained labels in the selected high-association regions, integrate the labels distributed across regions into a contiguous memory block, and use dense matrix multiplication to complete the label-level attention calculation; S3 performs two-layer routing attention processing on the integrated labels. First, it dynamically suppresses the feature propagation of irrelevant background regions at the region level, and then strengthens the local feature response of the target region at the label level to generate an enhanced feature map containing global semantics and local details. S4 inputs the enhanced feature map into the neck network for multi-scale feature fusion, and combines it with the detection head of depthwise separable convolution to output the class probability and bounding box coordinates of the UAV target.

[0013] The method for detecting small targets by UAVs in complex scenarios according to an embodiment of the present invention may also have the following additional technical features: In one embodiment of the present invention, the step of segmenting the input image into multiple coarse-grained regions of fixed size, calculating the affinity matrix between each region and selecting highly correlated regions based on a Top-k strategy, and constructing a region-level correlation graph to filter background noise includes: S11, the sliding window algorithm is used to divide the input image into non-overlapping fixed-size regions, each region having a size of [missing information]. ;in, and These are the area height and width, respectively; S12, by calculating the cosine similarity of the region feature vectors. Construct an affinity matrix; where, and The first The region and the first The feature vectors of each region are used to retain only the top-ranked regions in terms of similarity. The associated region is connected.

[0014] In one embodiment of the present invention, the step of performing a label collection operation on fine-grained labels within the selected high-association regions, integrating labels distributed across regions into a contiguous memory block, and using dense matrix multiplication to complete label-level attention calculation includes: S21, based on the highly correlated regions selected from the regional correlation graph, a spatial location sorting strategy is used to reorganize the scattered markers into contiguous memory blocks according to the regional coordinate order; S22, through formula Calculate the spatial location weight matrix ;in and These are the query vector and the key vector, respectively. is the dimension of the key vector.

[0015] In one embodiment of the present invention, the two-layer routing attention processing on the integrated labels first dynamically suppresses feature propagation in irrelevant background regions at the region level, and then enhances the local feature response of the target region at the label level to generate an enhanced feature map containing global semantics and local details, including: S31, Regional-level dynamic suppression is achieved through the formula... To achieve; among which, This is an intermediate feature map. This is the output feature of the first-level pooling; S32, the marker-level local feature response is expressed by the formula... To achieve; among which, and These are the output features of the second and third level pooling, respectively.

[0016] In one embodiment of the present invention, the step of inputting the enhanced feature map into the neck network for multi-scale feature fusion, and combining the detection head with depthwise separable convolution to output the class probability and bounding box coordinates of the UAV target, includes: S41, the neck network adopts a PAN-FPN bidirectional feature fusion architecture, through the formula Achieve high-level feature upsampling; among which, The deep features output by the backbone network; S42, the detection head passes through the formula To achieve bounding box coordinate distribution prediction; where, The first output of the network The probability distribution of each discrete distance interval. This represents the final regression distance.

[0017] In one embodiment of the present invention, it further includes: S5 performs post-processing on the bounding box coordinates output by the detection head.

[0018] To achieve the above objectives, another aspect of the present invention provides a small target UAV detection device in complex scenarios, comprising: The region segmentation and association graph construction module is used to segment the input image into multiple coarse-grained regions of fixed size, calculate the affinity matrix between each region, and select highly associated regions based on the Top-k strategy to construct a region-level association graph to filter background noise. The label collection and attention calculation module is used to perform label collection operations on fine-grained labels in the selected high-association regions, integrate labels distributed across regions into a contiguous memory block, and complete label-level attention calculation using dense matrix multiplication; The dual-layer routing attention processing module is used to perform dual-layer routing attention processing on the integrated labels. First, it dynamically suppresses the feature propagation of irrelevant background regions at the region level, and then strengthens the local feature response of the target region at the label level to generate an enhanced feature map containing global semantics and local details. The multi-scale feature fusion and detection output module is used to input the enhanced feature map into the neck network for multi-scale feature fusion, and combine it with the detection head with depthwise separable convolution to output the class probability and bounding box coordinates of the UAV target.

[0019] In one embodiment of the present invention, it further includes: The post-processing module is used to perform post-processing on the bounding box coordinates output by the detection head.

[0020] This invention discloses a method and apparatus for detecting small-target UAVs in complex scenarios. Based on region-level correlation graph construction and a two-layer routing attention mechanism, it effectively addresses the core shortcomings of existing convolutional networks, such as locality limitations, redundant attention calculations, and high computational costs of global modeling. By dynamically selecting highly correlated regions to filter background noise, integrating labels to achieve efficient attention calculation, and combining multi-scale feature fusion with a lightweight detection head, it significantly improves the detection accuracy, robustness, and inference efficiency of small-sized UAV targets in complex backgrounds, while reducing computational overhead and enhancing the applicability and reliability of the model in real-world scenarios such as real-time monitoring.

[0021] To achieve the above objectives, a third aspect of this application provides a computer device, including a processor and a memory; wherein the processor reads executable program code stored in the memory to run a program corresponding to the executable program code, for implementing a method for detecting small target UAVs in complex scenarios as described in the first aspect embodiment.

[0022] To achieve the above objectives, the fourth aspect of this application proposes a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a method for detecting small target UAVs in complex scenarios as described in the first aspect embodiment.

[0023] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0024] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 This is a flowchart of a method for detecting small target UAVs in complex scenarios according to an embodiment of the present invention; Figure 2 This is a YOLOv11 network architecture diagram of another method for detecting small target UAVs in complex scenarios according to an embodiment of the present invention; Figure 3 This is an improved YOLOv11 network architecture diagram of another method for detecting small target UAVs in complex scenarios according to an embodiment of the present invention; Figure 4 This is a schematic diagram of a small target UAV detection device in a complex scenario according to an embodiment of the present invention; Figure 5 It is a computer device according to an embodiment of the present invention. Detailed Implementation

[0025] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0026] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0027] The following description, with reference to the accompanying drawings, describes a method, apparatus, device, and storage medium for detecting small targets in complex scenarios according to embodiments of the present invention.

[0028] The core idea of ​​this invention is to effectively address the challenge of small target recognition for UAVs in complex backgrounds by constructing a hierarchical attention detection framework that progresses from coarse-grained region selection to fine-grained feature enhancement. First, the input image is segmented into coarse-grained regions, and a region-level association graph is constructed based on affinity selection, enabling proactive filtering and noise suppression of large areas of irrelevant background. Then, highly correlated regions are labeled and integrated, and label-level attention calculation is performed using structured memory layout and efficient matrix operations, reducing computational complexity while maintaining the integrity of feature representation. Furthermore, a two-layer routing attention mechanism dynamically suppresses background interference at the region level and enhances local target details at the label level, generating enhanced feature representations that integrate global semantics and local discriminative information. Finally, a multi-scale feature fusion network and a lightweight detection head are used to achieve synchronous and accurate output of UAV target category and location, thereby significantly improving the model's robustness and inference efficiency in complex scenes while ensuring detection accuracy.

[0029] Example 1 To achieve the above invention, embodiments of the present invention provide a method for detecting small target UAVs in complex scenarios, such as... Figure 1 As shown, it includes: S1 divides the input image into multiple coarse-grained regions of fixed size, calculates the affinity matrix between each region, and selects highly correlated regions based on the Top-k strategy to construct a region-level correlation map to filter background noise.

[0030] Specifically, this step is a core component of the BiFormer attention module, designed to achieve sparsification of feature maps and improve the model's ability to detect small targets in complex backgrounds.

[0031] Specifically, image segmentation employs a fixed-size, non-overlapping region partitioning strategy, typically dividing the input feature map into... , where and These represent the height and width of the area, respectively, and are generally set to... or This ensures that each region contains sufficient semantic information. The feature vector of each region is extracted using Global Average Pooling (GAP) or Region Feature Embedding to form a region feature matrix. ,in Indicates the total number of regions. For feature dimensions.

[0032] Furthermore, the affinity matrix between regions It is obtained by calculating the cosine similarity or dot product between regional features, and the formula is: ; in This represents the region index. When constructing the region-level association graph, a Top-k strategy is used, meaning that for each region... Only retain the one with the highest affinity. Connecting several regions, among which Typically set to This strategy aims to balance computational efficiency with information integrity. It effectively suppresses redundant computation in the background region, focusing attention on areas relevant to the target.

[0033] Specifically, this step is particularly suitable for drone detection tasks in complex backgrounds such as urban buildings and dense vegetation. Through region-level route filtering, the model can initially filter background noise during the feature extraction stage, thereby improving the efficiency and accuracy of subsequent attention calculations. In terms of technical effects, this step significantly reduces the redundancy of attention calculations, improves the model's ability to perceive small targets, and reduces the waste of computing resources, laying an efficient and focused foundation for subsequent label-level attention calculations.

[0034] Furthermore, S1 includes: S11, the sliding window algorithm is used to divide the input image into non-overlapping fixed-size regions, each region having a size of [missing information]. ;in, and These represent the area's height and width, respectively.

[0035] Specifically, this step is a prerequisite for achieving regional-level route filtering. Its core function is to divide the global feature map into several local regions, thereby providing structured input for the subsequent attention mechanism and enabling dynamic identification of key regions and efficient allocation of computing resources.

[0036] Furthermore, the sliding window algorithm sets a fixed step size. Starting from the top left corner of the image, move the window row by row and column by column in a non-overlapping manner to move the original image... Divided into several sub-regions The size of each sub-region is ,in and Typically set to or This approach balances computational efficiency with semantic expressiveness. It ensures no overlap between regions, avoids redundant computation, and guarantees the integrity of region coverage.

[0037] Furthermore, the partitioning of the sliding window must satisfy the following condition: Let the input image size be... Then the number of regions after division is ,in Indicates a floor operation. Step size. Usually related to window size , The dimensions are equal to ensure non-overlapping partitioning. In addition, to prevent the loss of edge region information, zero-padding can be performed on the image boundaries to make all regions the same size.

[0038] Specifically, this step is mainly applied to the feature map preprocessing stage in UAV detection tasks. In complex backgrounds (such as urban buildings and vegetation occlusion), the original image contains a large number of meaningless background regions. By using a sliding window, the feature map can be divided into multiple semantic units, facilitating efficient filtering and processing by subsequent region-based attention mechanisms. This method is particularly suitable for processing high-resolution images, effectively reducing the computational complexity of attention and improving the model's deployment capability on resource-constrained devices (such as embedded UAV detection systems).

[0039] Specifically, the sliding window partitioning, through structured input, provides fundamental support for the region-level route filtering in the BiFormer module. This step significantly reduces the computational scope of the attention mechanism, allowing the model to focus on potential target regions, thereby improving the accuracy and robustness of small target detection in complex scenarios. Simultaneously, the non-overlapping partitioning strategy avoids redundant computation, reduces memory usage, and improves overall inference efficiency.

[0040] S12, by calculating the cosine similarity of the region feature vectors. Construct an affinity matrix; where, and The first The region and the first The feature vectors of each region are used to retain only the top-ranked regions in terms of similarity. The associated region is connected.

[0041] Specifically, this step aims to perform coarse-grained semantic association analysis on the input feature map, thereby filtering out regions with high semantic relevance to the current region, providing sparse but crucial contextual information for subsequent label-level attention computation.

[0042] Furthermore, the input feature map is divided into several regions of fixed size, each region corresponding to a feature vector. This represents the semantic information of the region. The granularity of region division is usually [missing information]. The grid in which The value can be adjusted based on the resolution of the input image and computing resources; a typical value is... or By calculating any two regions and The cosine similarity between the feature vectors can be used to construct a... Affinity matrix ,in This represents the total number of regions. The formula for calculating cosine similarity is: .

[0043] Furthermore, this formula quantifies the cosine of the angle between the feature vectors of two regions, with a value range of [-1, 1]. The closer the value is to 1, the more semantically similar the two regions are. In practice, the feature vector of each region... Feature maps output by the backbone network are typically extracted using Global Average Pooling (GAP) or Regional Average Pooling (RAP) to obtain fixed-dimensional vector representations for easier subsequent computation.

[0044] Furthermore, to achieve sparse sensing, the system employs a Top-k filtering strategy, retaining only each region. The top in terms of similarity area The connection. Among them The preset number of sparse connections is usually set to 1. or This strategy aims to strike a balance between computational efficiency and information integrity. By suppressing redundant computation in the background region, it focuses the attention mechanism on the potential target region, thereby improving the model's ability to detect small-target UAVs.

[0045] Specifically, through region-level semantic association analysis, the model can identify regions with similar semantic features to the target region, providing contextual support for subsequent label-level attention computation. Meanwhile, the Top-k strategy effectively reduces computational complexity, avoiding the intensive computation of full-image features required by traditional attention mechanisms, thereby improving the model's inference efficiency and resource utilization.

[0046] S2 performs a label collection operation on the fine-grained labels in the selected high-association regions, integrates the labels distributed across regions into a contiguous memory block, and completes the label-level attention calculation using dense matrix multiplication.

[0047] Specifically, the core objective of this step is to reorganize the tokens, which were originally distributed across regions, into contiguous memory blocks, thereby providing a hardware-friendly data layout for subsequent dense matrix multiplications and significantly improving computational efficiency.

[0048] Specifically, this step first identifies other regions with high semantic relevance to the current region based on the results of region-level route filtering. Each region typically consists of fixed-size image patches (such as...). or The image is composed of several fine-grained markers. These markers represent the semantic information of local regions in the image and are typically generated through convolution operations or embedding layers. In region-level filtering, only the regions with the highest relevance to the image are retained. Areas (e.g.) This forms a sparse regional correlation graph.

[0049] Furthermore, during the label-level attention computation phase, the system collects these labels distributed across regions. Specifically, for each region... Its associated region set is ,in Indicates and The system uses a set of related region indexes to sequentially concatenate the tags from these regions, forming a continuous tag sequence. Its dimensions are ,in For batch size, The number of aggregated tags (usually 1) , (Number of tags for a single region) For the labeled feature dimensions (e.g.) or ).

[0050] Furthermore, by organizing the tags into contiguous memory blocks, the system can leverage the GPU's SIMD (Single Instruction Multiple Data) architecture to perform attention computation using dense matrix multiplication. Specifically, the query matrix... Key matrix Sum matrix All based on The attention weights are calculated using the following formula: ; in, Let be the dimension of the key vector. The Softmax operation is used to normalize the attention weights. Since the labels have been formed into contiguous memory through the collection operation, this matrix multiplication can be performed efficiently on the GPU, avoiding the performance bottleneck caused by non-contiguous memory in traditional sparse attention mechanisms.

[0051] Specifically, this step is widely applicable to scenarios such as complex background suppression and small target enhancement in drone detection. For example, in urban environments with buildings or vegetation obstruction, the system can focus its attention on areas where targets may exist through a marker collection strategy, thereby improving detection accuracy and reducing false detection rates.

[0052] Specifically, the technical value of this step lies in its ability to significantly reduce the computational complexity and memory overhead of attention computation without losing key semantic information. Experiments show that this strategy can improve the efficiency of attention computation by 3.2 times while maintaining a key information retention rate of over 90%, providing strong support for real-time UAV detection in complex scenarios.

[0053] Furthermore, S2 includes: S21, based on the highly correlated regions selected from the regional correlation graph, a spatial location sorting strategy is used to reorganize the scattered markers into contiguous memory blocks according to the regional coordinate order.

[0054] Specifically, the core objective of this step is to optimize the storage and computation of tokens to adapt to the efficient processing characteristics of GPUs and other hardware for accessing contiguous memory, thereby improving overall computational efficiency.

[0055] Specifically, this step first relies on the results of region-level route filtering. The BiFormer module divides the input feature map into coarse-grained regions of fixed size (e.g., or The graph constructs a region-level association graph by calculating the affinity matrix between regions (region blocks). In this graph, each region node is connected to several highly associated region nodes, and the connection relationship is determined by a Top-k strategy, that is, each region only retains the nodes with the highest semantic relevance to it. Each region is connected. In some implementations, The range of values ​​is usually 100. The specific value can be adjusted according to the complexity of the actual scenario and computing resources.

[0056] Furthermore, in the label-level attention calculation stage, BiFormer performs local attention processing on fine-grained labels within each region. Since the labels after Top-k selection are distributed across multiple non-contiguous regions, traditional sparse matrix multiplication suffers from low memory access efficiency and poor parallelism when processing such scattered labels. To address this, this invention introduces a spatial location sorting strategy, linearly reorganizing these labels according to the coordinate order of their respective regions to form contiguous memory blocks. Specifically, the system first assigns region numbers to all selected labels, then arranges the labels sequentially according to their numbering order, forming a contiguous memory block with dimension [missing information]. tensors (where For batch size, To mark the total number, (This is the number of channels), thus providing conditions for continuous memory access for subsequent dense matrix multiplications.

[0057] Specifically, the performance optimization effect of this step is closely related to the granularity of label recombination, the size of the region partition, and the threshold for Top-k selection. For example, too small a region partition will lead to an increase in the number of labels, affecting computational efficiency; too large a region partition may miss key target regions. In practical applications, the region size is usually set to... Top-k value set to In order to achieve a balance between computational efficiency and information retention.

[0058] Specifically, this step is widely applicable to real-time UAV detection systems in complex environments, especially in scenarios involving urban buildings, vegetation obstruction, and low-altitude flight, effectively improving the model's ability to identify small targets. By reorganizing the tags into contiguous memory blocks, the system can fully utilize the parallel computing power of the GPU to accelerate attention calculations, thereby meeting the UAV defense system's requirements for low latency and high accuracy detection.

[0059] Specifically, the technical benefits of this step are a significant improvement in attention computation efficiency and model inference speed. Experiments show that after adopting this strategy, memory access latency for attention computation is reduced by approximately 40%, and overall computational efficiency is improved. The improvement is significant, with a 2.1% increase in mAP and a 15% reduction in false positive rate in small object detection tasks. This improvement not only enhances the model's adaptability to complex scenarios but also provides higher resource utilization and operational stability for practical deployment.

[0060] S22, through formula Calculate the spatial location weight matrix ;in and These are the query vector and the key vector, respectively. is the dimension of the key vector.

[0061] Specifically, the technical implementation of this step is based on the self-attention mechanism in the Transformer architecture, but by introducing a two-layer routing strategy, it achieves sparse perception and efficient computation of feature maps.

[0062] Specifically, this step first involves inputting the feature map. (in , These represent the height and width of the feature map, respectively. (The number of channels) is mapped to query vectors through a linear projection operation. and key vector Projection operations typically employ learnable weight matrices. ,in This represents the dimension of the key vector. The selection of should match the overall number of model parameters and computational complexity, and is usually set to . or To balance feature representation capability with computational overhead.

[0063] Furthermore, subsequently, through the formula Calculate the spatial location weight matrix .in, This represents the dot product operation between the query and the key, used to measure the correlation between any two spatial locations in the feature map. Since the dot product result can be too large, leading to vanishing gradients or numerical instability, a scaling factor is introduced. The dot product result is normalized. The Softmax function then converts the normalized dot product result into a probability distribution, so that the attention weight at each position is in the range [0, 1] and the sum is 1, thereby achieving dynamic focusing on key regions in the feature map.

[0064] Specifically, this step is mainly used in the feature enhancement stage of UAV detection tasks. Especially in complex backgrounds (such as urban buildings and vegetation occlusion), an attention mechanism is used to weighted enhance regions in the feature map that may contain UAV targets, suppressing interference from irrelevant backgrounds. This operation is usually performed in the label-level attention calculation stage of the BiFormer module, used for local feature interaction on key labels after region-level route filtering.

[0065] Specifically, a sparse attention mechanism significantly reduces computational complexity while preserving key semantic information. Compared to traditional C2PSA modules, BiFormer uses a Top-k filtering strategy to retain only the top-ranking regions for each area. Connecting highly correlated regions allows attention calculation to be performed globally. Reduce to ,in Typically, the value is set to 4 or 8. Furthermore, the tag collection strategy rearranges sparse tags into contiguous memory blocks, enabling subsequent dense matrix multiplication operations to efficiently utilize the GPU's parallel computing capabilities, thereby improving overall inference efficiency. This step plays a dual role in the model—"dynamic focusing" and "efficient computation"—and is a key technical step in achieving accurate target detection and low-latency inference for UAVs in complex scenarios.

[0066] S3 performs two-layer routing attention processing on the integrated labels. First, it dynamically suppresses feature propagation in irrelevant background regions at the region level, and then strengthens the local feature response of the target region at the label level, generating an enhanced feature map containing global semantics and local details.

[0067] Specifically, this step aims to address the problems of feature loss, severe background interference, and computational redundancy in the traditional YOLOv11 model when detecting small-target UAVs in complex backgrounds. This module achieves efficient optimization and semantic enhancement of the feature map through two stages: "region-level dynamic suppression" and "label-level local enhancement."

[0068] Furthermore, in the region-level dynamic suppression stage, BiFormer divides the input feature map into coarse-grained regions of fixed size (e.g., or The system divides regions and calculates an affinity matrix between them based on their feature vectors. This matrix typically uses cosine similarity or dot product to quantify the semantic relevance between regions. Then, a Top-k selection strategy is employed to retain only the regions with the highest similarity to the remaining regions. Connections (e.g.) or This process effectively filters feature propagation from large, irrelevant background regions, reduces redundant computation, and improves the model's ability to focus on the target region.

[0069] Furthermore, in the token-level attention computation stage, BiFormer performs local attention computation on fine-grained tokens within each selected key region. Considering the GPU's optimized access to contiguous memory, BiFormer introduces a token collection strategy to reorganize target tokens distributed across regions into contiguous memory blocks, thus avoiding the memory fragmentation problem caused by uneven token distribution in traditional sparse attention mechanisms. Based on this, attention computation is completed through dense matrix multiplication, significantly improving computational efficiency. Experiments show that this strategy can improve attention computation efficiency by approximately 3.2 times.

[0070] Specifically, this step plays a crucial role in the overall technical solution, providing an enhanced feature map that incorporates both global semantics and local details. This provides high-quality input for the multi-scale feature fusion in the subsequent Neck stage. Through dual optimization at the region and label levels, BiFormer effectively improves the model's ability to detect small targets in complex backgrounds while reducing computational overhead, providing solid technical support for real-time detection of UAVs in complex low-altitude environments.

[0071] Furthermore, S3 includes: S31, Regional-level dynamic suppression is achieved through the formula... To achieve; among which, This is an intermediate feature map. This is the output feature of the first-level pooling.

[0072] Specifically, the core of this step lies in the intermediate feature map. Max pooling is performed to extract feature representations with a larger receptive field, thereby enabling the focus on key regions and suppression of background noise in subsequent attention mechanisms.

[0073] Specifically, this step first receives from Intermediate feature map after channel compression in convolutional layer Its channel count is typically half that of the input feature map to reduce subsequent computational complexity. Then, it employs... Max Pooling Operation, pooling kernel size is The stride is set to 0 by default. This is to achieve spatial downsampling of the feature map. This operation is performed on each... The pooling operation selects the maximum value within a local region as the output, preserving the most significant feature response while suppressing local noise and redundant information. In some implementations, pooling operations can be combined with padding strategies, such as `same` padding, to maintain the spatial resolution consistency of the feature maps, facilitating subsequent feature stitching and fusion.

[0074] Furthermore, the pooling kernel size in this step It is one of the experimentally verified optimal choices, capable of increasing the receptive field while controlling computational overhead. In the SPPF module of YOLOv11, the cascading design of max pooling operations allows the receptive field to expand progressively; the first-stage pooling is equivalent to... Sensing field, second-level pooling is equivalent to The third-level pooling is equivalent to This enhances the ability to perceive small targets without increasing model complexity.

[0075] Specifically, this step is mainly used for the initial suppression of complex backgrounds (such as urban buildings and vegetation) in UAV detection tasks. Through region-level max pooling, the model can extract features with stronger semantic information, providing basic input for subsequent region-level route selection and label-level attention calculation. Especially in long-distance, small-scale UAV target detection, this step helps to preserve the edge and texture features of the target, preventing them from being submerged by background noise in deep networks.

[0076] Specifically, on the one hand, through max pooling, the model can effectively extract features with a larger receptive field, enhancing its ability to perceive small targets; on the other hand, the non-linear characteristics of pooling help suppress local noise and improve the robustness of feature maps. In the BiFormer module, this step serves as a preprocessing step for region-level route selection, laying the foundation for efficient computation of the subsequent attention mechanism and significantly improving the model's detection accuracy and computational efficiency in complex scenes.

[0077] S32, the marker-level local feature response is expressed by the formula... To achieve; among which, and These are the output features of the second and third level pooling, respectively.

[0078] Specifically, this step is the feature fusion step after attention calculation in the BiFormer module, which aims to integrate multi-scale local features with the original intermediate features to enhance the model's perception ability of small target drones.

[0079] Specifically, this step first uses a region-level routing filtering mechanism to divide the input feature map into several coarse-grained regions of fixed size (e.g., or The regions are divided into blocks, and a region affinity matrix is ​​constructed based on the cosine similarity or dot product operation of the region features. Then, a Top-k strategy is used to select the top-k regions for each area. In the highly correlated regions, only the feature information of the key semantic regions is retained, thereby achieving initial suppression of background noise. In the tag-level attention computation, BiFormer further applies local attention weighting to the fine-grained tags in these key regions, and integrates the tags across regions into contiguous memory blocks through a tag collection strategy to support efficient dense matrix multiplication operations and avoid the memory fragmentation problem caused by traditional sparse attention mechanisms.

[0080] Furthermore, the steps used in this process Convolutional layers have the dual function of channel compression and feature fusion, and their number of channels is usually set to a fraction of the number of input feature channels. or To reduce computational complexity. (Concatenation operation) Original intermediate features With the characteristics of three-level pooling The feature maps are concatenated along the channel dimension to obtain the final output feature map. The number of channels is ,in This is to ensure consistency in feature dimensions.

[0081] Specifically, this step is mainly applied to drone detection tasks in complex backgrounds such as urban buildings and vegetation obstruction. By fusing multi-scale features with attention-weighted key region features, the model can more accurately capture the edge and texture features of drones in low-resolution, high-noise images, thereby improving detection accuracy and robustness.

[0082] Specifically, by combining multi-scale features with an attention mechanism, the model's ability to perceive small targets is significantly enhanced, while also... Convolution enables channel compression and feature fusion, reducing computational overhead and improving the feasibility of deploying the model on embedded devices or edge computing platforms. Furthermore, this design effectively alleviates the resource waste problem of traditional attention mechanisms during global computation, achieving "dynamic sparse perception" and providing high-quality feature support for the high-precision output of subsequent detection heads.

[0083] S4 inputs the enhanced feature map into the neck network for multi-scale feature fusion, and combines it with the detection head of depthwise separable convolution to output the class probability and bounding box coordinates of the UAV target.

[0084] Specifically, this step plays a crucial role in the YOLOv11 architecture, effectively integrating the multi-scale semantic features extracted by the backbone network and achieving the final detection output through an optimized detection head structure.

[0085] Specifically, this step first inputs the feature map enhanced by the BiFormer module into the neck network, which employs a bidirectional feature fusion architecture of PAN-FPN (Path Aggregation Network - Feature Pyramid Network). Specifically, PAN-FPN upsamples high-level semantic features and concatenates them with low-level high-resolution features via a top-down path, thereby enhancing the semantic understanding of small targets; simultaneously, it downsamples low-level strong localization features and fuses them with high-level features via a bottom-up path to supplement spatial detail information. During the fusion process, the C3k2 module can optionally be introduced for secondary feature extraction and refinement, further improving the robustness and consistency of feature representation.

[0086] Furthermore, feature fusion operations in the neck network are typically performed at three scales: P3, P4, and P5, with feature map sizes of 1 / 8, 1 / 16, and 1 / 32 of the input image, respectively. During fusion, the number of channels in each layer's feature map must remain consistent, usually achieved through 1×1 convolutions. Depthwise separable convolution is employed in the detection head, its structure consisting of depthwise convolutions and pointwise convolutions. Depthwise convolutions perform independent spatial filtering on each input channel, while pointwise convolutions linearly combine information between channels using 1×1 kernels. This structure significantly reduces computational complexity while maintaining the receptive field. Specifically, if the number of input channels is... The feature map size is Then the computational cost of standard convolution is The computational cost of depthwise separable convolution is... ,in is the kernel size.

[0087] Specifically, this step is widely used in real-time detection systems for low-altitude unmanned aerial vehicles (UAVs), especially in complex backgrounds such as urban building clusters and densely vegetated areas. Through multi-scale feature fusion and a detection head with depthwise separable convolution, it can effectively improve the ability to identify small-target UAVs. For example, in scenarios such as UAV inspection and security monitoring, the target may occupy only a very small proportion of the image and is often accompanied by occlusion and background interference. This step, by fusing semantic and localization information at different scales, enhances the model's ability to perceive the target, thereby significantly reducing the false negative and false positive rates.

[0088] Specifically, this step achieves efficient and accurate detection of UAV targets. Through multi-scale feature fusion, the model can simultaneously capture the global semantics and local details of the target, improving its adaptability to targets at different scales. The introduction of depthwise separable convolution effectively reduces the model's computational overhead, improves inference speed, and meets the low-latency requirements of real-time detection. Furthermore, combined with the sparse attention mechanism of the BiFormer module, this step effectively suppresses background noise before feature fusion, thereby improving the output quality of the detection head and ultimately achieving high-precision prediction of the UAV target's class probability and bounding box coordinates.

[0089] Furthermore, S4 includes: S41, the neck network adopts a PAN-FPN bidirectional feature fusion architecture, through the formula Achieve high-level feature upsampling; among which, These are the deep features output by the backbone network.

[0090] Specifically, this step is achieved through the formula Implement upsampling operations for high-level features, where This represents the deep feature map output by the backbone network. This represents the upsampled high-level feature map, which is used to fuse with shallow features.

[0091] Furthermore, this upsampling operation typically employs methods such as transposed convolution or nearest neighbor interpolation to improve the spatial resolution of deep feature maps to match that of shallow feature maps. Figure 1 To illustrate, taking transposed convolution as an example, it simulates the convolution process through a reverse operation, reducing the feature map size from... Expand to And keep the number of channels unchanged or through Convolution adjusts the number of channels. This operation restores the spatial details of deep features without introducing additional parameters, providing high-resolution semantic information for subsequent feature concatenation and fusion.

[0092] Furthermore, the stride of the upsampling operation is typically set to 2 to double the feature map size. Simultaneously, to avoid information distortion during upsampling, an optional deconvolution kernel size of [size missing] can be introduced. A step size of 2 and padding of 1 are used to ensure that the output feature map matches the target scale. Furthermore, the upsampled feature map... With shallow feature map The concat operation is used to concatenate the data along the channel dimension to form a fused feature map. Its number of channels is ,in and These represent the number of channels for upsampled features and shallow features, respectively.

[0093] Specifically, this step is widely applied to multi-scale target detection tasks using UAVs in complex backgrounds (such as urban buildings, vegetation obstruction, and cloud interference). By fusing deep semantic features with shallow spatial details, the model can more accurately capture the edge contours and key component features of the UAV, thereby improving the recall rate and localization accuracy of small target detection. Especially in long-distance, low-resolution images, this fusion mechanism helps to recover the structural information of the target and reduce missed detections caused by feature blurring.

[0094] Specifically, this step significantly enhances the model's adaptability to complex scenes through a bidirectional feature fusion mechanism. On one hand, upsampling of high-level semantic features provides stronger semantic representation for small targets; on the other hand, downsampling of low-level features supplements spatial details for high-level features, thereby constructing a feature pyramid that complements semantic and localization information at the P3, P4, and P5 scales. This design effectively controls computational complexity while improving detection accuracy, laying a solid foundation for efficient inference by the subsequent detection head.

[0095] S42, the detection head passes through the formula To achieve bounding box coordinate distribution prediction; where, The first output of the network The probability distribution of each discrete distance interval. This represents the final regression distance.

[0096] Specifically, the core idea of ​​this step is to replace the traditional point regression method with expectation regression based on probability distribution, thereby improving the robustness and accuracy of the model in complex background and small target detection tasks.

[0097] Specifically, this step first calculates the continuous distance between the target bounding box and the center point of the grid. Discretize into There are 3 equally spaced intervals, each interval corresponding to a discretized distance index. The network outputs a length of [length missing] at each location. probability distribution vector This indicates that the target bounding box distance falls within the th position. The probability distribution is the sum of the probabilities of each interval. This probability distribution is typically normalized using the Softmax function to normalize the original distribution of the network output, ensuring that the sum of all probability values ​​is 1. The final regression distance The mathematical expectation of this distribution is given by, i.e. ,in The index representing the discretized distance. This represents the probability value for the corresponding index.

[0098] Furthermore, the number of discretized intervals The settings directly affect the model's positioning accuracy and computational complexity. In this invention, Typically, values ​​of 16 or 32 are chosen to strike a balance between accuracy and efficiency. Each grid cell outputs independent distributions in four directions (left, top, right, and bottom), corresponding to the distances between the bounding box and the center point, respectively. Furthermore, to improve the model's adaptability to occluded and blurred targets, the network output distribution needs to have a certain degree of smoothness, avoiding overly sharp or concentrated probability distributions, thereby enhancing the model's tolerance to uncertainty.

[0099] Specifically, this step is particularly suitable for UAV target detection tasks in complex backgrounds. Since UAVs typically appear as small targets in images with blurred boundaries and significant deformation, traditional point regression methods are easily affected by noise, leading to positioning errors. By introducing a distribution prediction mechanism, the model can utilize global information from the probability distribution to make a more robust estimate of the target's location, thereby significantly reducing false positives and false negatives in complex scenes such as urban buildings and vegetation obstructions.

[0100] Specifically, by using expectation regression, the model not only outputs a single bounding box coordinate, but also performs a weighted average of the target position based on a probability distribution. This allows for high-precision localization even when the target edges are unclear or occluded. This method replaces the traditional regression method in the YOLOv11 Header, significantly improving the model's detection performance in complex low-altitude environments. It is one of the key technical means for achieving efficient and accurate UAV detection in this invention.

[0101] S5 performs post-processing on the bounding box coordinates output by the detection head.

[0102] Specifically, this step is achieved through the formula The predicted bounding box coordinate distribution is modeled and optimized, among which... Indicates the first The true distance between each side The distance predicted by the model. To predict the standard deviation of the distribution, This is the number of sides of the bounding box (usually 4, corresponding to the left, top, right, and bottom sides).

[0103] Furthermore, this loss function is modeled based on a Gaussian distribution, transforming the bounding box coordinate regression problem into a distance distribution prediction problem. Instead of directly outputting a single bounding box coordinate value, the model outputs a discretized probability distribution, with each location corresponding to a distance interval. These probabilities are normalized using the Softmax function, and their expected value is calculated as the final predicted bounding box coordinate value. This loss function guides the model to learn a more robust bounding box localization capability by minimizing the difference between the predicted and true distributions, effectively mitigating the sensitivity of traditional regression methods to noise, especially when the target edges are blurred or partially occluded.

[0104] Furthermore, in this loss function It is a part of the model output, representing the uncertainty of the predicted distribution. Its value is typically predicted through an additional output layer, and... Shared feature extraction paths. During training, and These are optimized together, allowing the model to adaptively adjust the prediction confidence for different edges. Furthermore, the computational complexity of this loss function is O(n log n). It is comparable to traditional L1 or L2 loss, but its localization robustness in complex backgrounds is significantly better than traditional methods.

[0105] Specifically, this step is mainly used in the post-processing stage of UAV detection tasks, especially in complex scenarios such as urban buildings and vegetation obstruction, where it can effectively improve the bounding box regression accuracy of small targets. By introducing distributed modeling, the model can still output reasonable bounding box predictions when faced with blurred target edges, occlusion, or background interference, thereby improving the overall detection performance.

[0106] Specifically, by modeling through probability distributions, the model can more comprehensively express the uncertainty of bounding box predictions, enhancing its ability to locate small targets in complex scenes. Furthermore, this loss function is compatible with traditional regression losses, facilitating integration into existing object detection frameworks and demonstrating good practicality and scalability.

[0107] This invention presents a method for detecting small-target UAVs in complex scenarios. Based on region-level correlation graph filtering and a two-layer routing attention mechanism, it effectively addresses the core shortcomings of existing detection schemes, such as the limited receptive field of convolutional networks, redundant global attention calculations, and high computational costs. This method filters background noise through coarse-grained region filtering, integrates labels to achieve efficient attention calculation, and combines multi-scale feature fusion with a lightweight detection head to achieve end-to-end optimization from feature enhancement to target output. This significantly improves the detection accuracy, robustness, and inference efficiency of small UAV targets in complex backgrounds such as building occlusion and vegetation interference, enhancing the model's applicability and reliability in practical security and surveillance scenarios.

[0108] Example 2 To achieve the above invention, embodiments of the present invention also provide another method for detecting small target UAVs in complex scenarios, including: In one embodiment of the present invention, conventional UAV detection includes: Specifically, radar detection utilizes the principle of electromagnetic wave reflection to determine the target's range, azimuth, and velocity by transmitting radar waves into the airspace and receiving the echoes. More specifically, radar detection technology is based on the principle of electromagnetic wave scattering. The radar transmitter emits modulated electromagnetic waves (such as linear frequency modulated continuous wave, FMCW) into the airspace. When the beam encounters a UAV target with a dielectric constant different from that of air, some of the electromagnetic energy is backscattered due to impedance mismatch, forming an echo. The system then analyzes the echo signal to calculate parameters.

[0109] Specifically, distance measurement: based on the propagation speed of electromagnetic waves. The time delay or frequency difference of the echo relative to the transmitted wave is calculated. In the FMCW system, the distance... Beat frequency Proportional, the formula is (in For bandwidth, (This refers to the scan cycle).

[0110] Specifically, speed measurement: Utilizing the Doppler effect, it detects the frequency shift of the echo signal. To calculate the radial velocity of the target However, according to radar equations Received echo power It is inversely proportional to the fourth power of the target distance and also to the target's radar cross-section. It is directly proportional. Because small drones mostly use highly transparent plastic composite materials, their RCS is extremely small, resulting in weak echo energy. In complex low-altitude environments, they are easily masked by ground clutter, leading to serious missed detections.

[0111] In one embodiment of the present invention, acoustic detection includes: Specifically, acoustic detection is a technique for detecting unmanned aerial vehicles (UAVs) by deploying microphone arrays to collect and analyze ambient sound. During flight, the high-speed rotation of the UAV's rotors cuts through the air, generating aerodynamic noise with a clear pattern. The system first uses a microphone array to collect sound signals and then uses beamforming to enhance the sound signal from the target direction while suppressing background noise from other directions, thereby improving the availability of the effective signal.

[0112] Furthermore, in the signal processing stage, time-frequency analysis methods are typically used to process the acquired one-dimensional time-domain signal. Through short-time Fourier transform, the time-domain signal is mapped to a two-dimensional spectrogram, thereby obtaining the energy distribution of different frequencies over time. Its basic form can be expressed as: ; (in For input signal, For window functions, (To transform the number of points). Based on the spectrogram results, the system further analyzes the frequency domain characteristics, focusing on the characteristic frequency components generated by the UAV rotor rotation.

[0113] Furthermore, in the feature recognition process, the target is primarily determined based on the rotor's passing frequency and its harmonic characteristics. There is a clear physical relationship between the rotor's passing frequency, the motor speed, and the number of blades; the calculation formula is as follows: (in This refers to the motor speed. (This refers to the number of blades). When periodic comb-like spectral lines conforming to this pattern are detected in the spectrum, it can be determined that a drone target is present.

[0114] However, acoustic detection is quite sensitive to environmental conditions. Sound waves attenuate rapidly with distance as they propagate through the air; the sound pressure amplitude is approximately inversely proportional to the propagation distance (RRR). In complex acoustic environments such as cities, background interference such as traffic noise and wind noise is strong. The high-frequency sound signals generated by the rotors of micro UAVs are often submerged in the high-noise background, resulting in a low signal-to-noise ratio, which in turn affects the feature extraction effect and easily leads to missed detections or misjudgments.

[0115] In one embodiment of the present invention, a single-stage object detection algorithm based on deep learning (such as...) Figure 2 (as shown), including: Currently, the most representative and advanced mainstream drone detection solution in the industry is YOLO V11, whose main implementation scheme is as follows: Specifically, the overall architecture of YOLOv11 adopts the classic "Backbone + Neck + Head" architecture. This aims to achieve efficient feature extraction and multi-scale fusion. The Backbone is responsible for extracting multi-level features from the input image, ranging from shallow texture to deep semantics; the Neck is responsible for fusing features at different scales across layers to enhance the model's ability to perceive targets of different sizes; and the Head, based on the fused feature map, outputs the target's class confidence and bounding box coordinates. To achieve efficient feature extraction and multi-scale fusion, YOLOv11's Backbone uses a combination of C3k2 and C2PSA modules. The C3k2 module utilizes a cross-stage local connectivity structure combined with stacked small-sized convolutional kernels to extract texture and semantic features of the image while controlling the number of parameters. The C2PSA module introduces a spatial attention mechanism, weighting features by calculating the spatial weight matrix of the feature map to enhance the feature response of the target region and suppress background noise. The neck network adopts a bidirectional feature fusion architecture of PAN-FPN (Path Aggregation Network combined with Feature Pyramid). A top-down path upsamples high-level strong semantic features and concatenates them with low-level features, while a bottom-up PAN path downsamples low-level strong localization features and fuses them with high-level features. This structure ultimately outputs feature maps at three scales: P3, P4, and P5, realizing the interaction between semantic and spatial localization information and providing feature support for the detection head to classify and locate targets at different scales.

[0116] Specifically, for feature extraction (Backbone): a combined architecture of the C3K2 module, SPPF module, and C2PSA module is adopted. The C3K2 module uses a cascaded structure of dual 3×3 convolutional kernels to replace the traditional large-size convolutional kernels to extract basic features such as texture and edges of the image.

[0117] Furthermore, the SPPF module utilizes a multi-scale feature fusion mechanism to enhance the perception capability of targets of different sizes, significantly improving the detection accuracy of small targets. The core design of the SPPF module lies in replacing the parallel computation of the traditional SPP module through serial cascading, achieving efficient fusion of multi-scale receptive field features while reducing computational latency. For small-scale targets (such as long-range UAVs), very little feature information is retained in deep networks. SPPF effectively prevents the features of small targets from being overwhelmed by background noise by fusing "local details" and "global context." The specific implementation process is as follows: Input feature processing: Assume the input feature map is Firstly, through a The convolutional layers halve the number of channels to reduce subsequent computation and obtain intermediate features. Serial max pooling: used in parallel with traditional SPP Different convolution kernels, Use three consecutive Max pooling layers are cascaded; first-level pooling: for conduct Max pooling yields the output. At this point, the sensory field is equivalent to Second-level pooling: As input, proceed again. Max pooling yields the output. .two Pooling cascades are mathematically equivalent to a The receptive field; third-level pooling: will As input, perform the third time. Max pooling yields the output. Three Pooling cascading is equivalent to a Receptive field; Multi-scale feature stitching: The system stitches together the original intermediate features Pooling features that have undergone varying degrees of abstraction Concatenate along the channel dimension; Feature fusion output: The concatenated feature map contains features from local... Global The rich information of ) was finally processed through a Convolutional layers fuse channel information to output the final features.

[0118] Furthermore, the core calculation formula is: Let the input feature be... Convolution is Max pooling operation is The splicing operation is but The core processing flow can be represented by the following formula: ; ; ; ; .

[0119] Furthermore, the C2PSA module introduces a cross-scale pixel-level attention mechanism, which calculates a weight matrix of spatial locations in the feature map to perform weighted processing of the feature map, thereby allowing the model to focus on the main target region; its core calculation process is as follows: assuming the input feature map is... First, it is projected onto the query vector Q and the key vector K through a convolution operation, and then the calculation is performed. and The transpose of the dot product measures the correlation between any two pixels at spatial locations in the feature map. To prevent the dot product from becoming too large and causing gradient vanishing, and to obtain a normalized probability distribution, a scaling factor needs to be introduced. The spatial location weight matrix is ​​obtained by processing the data using the Softmax function. This process can be expressed as a formula. Finally, this weight matrix is ​​used The value vector V of the feature map is weighted and aggregated to dynamically enhance the feature response of key target regions.

[0120] In one embodiment of the present invention, the feature fusion and detection output (Neck & Head) is as follows: Specifically, Neck significantly enhances feature representation capabilities through the dual effects of a cross-scale feature interaction fusion mechanism and an attention mechanism: the attention mechanism acts as a "focusing" element, strengthening the feature response of key target regions through dynamic weighting; the interaction fusion mechanism acts as a "complementary" element, aggregating semantic and localization information at different scales through bidirectional paths. In the specific implementation process, the deep features output by the backbone network first pass through the C2PSA module, which uses queries and key vectors to calculate the spatial location weight matrix and weight the feature map, thereby effectively suppressing background noise and locking the UAV target before feature fusion. Subsequently, these attention-enhanced features enter the PAN-FPN structure. High-level strong semantic features are upsampled and concatenated with shallow high-resolution features to give small targets stronger semantic recognition. At the same time, shallow strong localization features are downsampled and fused with high-level features to supplement the spatial details of deep features. During this process, the C3k2 module is used for secondary feature extraction and refinement, ultimately constructing a multi-layered feature representation network that combines global semantic understanding, local detail capture, and attention focus.

[0121] Specifically, the Head: The detection head uses depthwise separable convolutions instead of traditional standard convolutional layers. The reason for this substitution is that depthwise separable convolutions decompose the standard convolution operation into two independent physical steps: first, depthwise convolution, which performs independent spatial filtering on each channel of the input; and second, pointwise convolution, which linearly combines the feature information from each channel. Compared to the intensive spatial and channel-wise computations performed simultaneously by standard convolutions, this decomposition strategy significantly reduces the number of model parameters and floating-point operations while maintaining the effective receptive field, thereby effectively reducing redundant computations and greatly improving the model's inference efficiency.

[0122] Meanwhile, the detection head, based on a multi-scale feature pyramid structure, employs a decoupled head to predict the category and bounding box separately, and utilizes a coordinate distribution prediction mechanism to achieve accurate localization. The specific implementation process is as follows: the distance regression problem from the grid center point to the four edges (left, top, right, and bottom) of the target box is transformed into the prediction of distance probability distributions. The network discretizes the continuous distance range into... The distance is divided into several intervals, and the Softmax function is used to predict the probability that the distance falls within each interval. The final regression distance Instead of a single predicted value, it is derived by calculating the mathematical expectation of the probability distribution. The core formula for this process is: ; in Represents the discretized distance index. This represents the confidence probability of the corresponding index output by the network. This expectation-based regression method effectively addresses the uncertainties caused by blurred or occluded drone target boundaries using distribution information, thereby achieving more accurate positioning.

[0123] To address the shortcomings of the existing YOLOv11 algorithm in extracting small-scale UAV target features against complex backgrounds (such as urban buildings, trees, and clouds) and the significant interference from background noise, an improved scheme is proposed that introduces a two-layer routing attention mechanism into the backbone network. The details are as follows (e.g.) Figure 3 (as shown) Specifically, the feature extraction network is improved: This invention retains the original C3k2 module of YOLOv11 for shallow feature extraction, but integrates and embeds a BiFormer attention module at a key deep position in the backbone network. The difference from existing technologies: Existing YOLOv11 typically only uses the C2PSA module, which performs intensive computation on the feature map globally or within a large window. The BiFormer module introduced in this invention adopts a Transformer architecture, but achieves "sparse awareness" through a two-layer routing mechanism. Technical function: Before features enter the neck network for fusion, BiFormer is used to "dynamically filter" deep semantic features. This allows the network to automatically identify and "ignore" large areas of irrelevant background, forcing computational resources to concentrate on a few areas containing potential drone targets, thereby suppressing the propagation of background noise during the feature extraction stage.

[0124] Specifically, the BiFormer module described in this invention achieves "dynamic sparse perception" of small-scale UAV targets through the following core algorithm steps, which is the key feature that distinguishes this technology from existing C2PSA technologies: Furthermore, for region-level route filtering: BiFormer segments the input image into coarse-grained regions of fixed size and constructs a region-level association graph by calculating the affinity matrix between regions. This matrix quantifies the semantic relevance between different regions based on the cosine similarity or dot product operation of region features. On this basis, a Top-k filtering strategy is employed to retain only the top k highly correlated region connections for each region, effectively filtering redundant information.

[0125] Furthermore, for tag-level attention computation: after identifying key regions, BiFormer performs local attention computation on fine-grained tags within each region. Considering the GPU's reliance on contiguous memory operations and the inefficiency of traditional sparse matrix multiplication when processing scattered tags, BiFormer innovatively adopts a tag collection strategy to integrate target tags distributed across regions into contiguous memory blocks, and completes attention computation using hardware-friendly dense matrix multiplication.

[0126] Specifically, the technical benefits are as follows: This design narrows the scope of global attention computation from the entire image to key regions, significantly reducing computational load while retaining over 90% of the key semantic information, thus enhancing the ability to capture drone models. Furthermore, it effectively avoids the memory fragmentation problem caused by sparse computation, improving computational efficiency by 3.2 times.

[0127] Another method for detecting small-target UAVs in complex scenarios, as described in this invention, achieves dynamic sparse perception based on a two-layer routing attention mechanism. This effectively addresses the core shortcomings of existing detection schemes, such as inefficient global modeling in complex backgrounds, severe background interference, and the easy submersion of small-target features. Through region-level association filtering and label-level attention enhancement, the entire process from noise filtering and feature focusing to multi-scale fusion is optimized, significantly improving the detection accuracy and robustness of small UAV targets in complex scenarios such as urban buildings and vegetation obstruction. At the same time, it greatly reduces computational overhead and enhances the deployment feasibility and system efficiency in real-time application scenarios such as security monitoring.

[0128] Example 3 To achieve the above invention, such as Figure 4 As shown, this embodiment also provides a small target UAV detection device 10 in complex scenarios, the device 10 including: The region segmentation and association graph construction module 100 is used to segment the input image into multiple coarse-grained regions of fixed size, calculate the affinity matrix between each region, and select highly associated regions based on the Top-k strategy to construct a region-level association graph to filter background noise.

[0129] The label collection and attention calculation module 200 is used to perform label collection operations on fine-grained labels in the selected high-association regions, integrate labels distributed across regions into a contiguous memory block, and complete label-level attention calculation using dense matrix multiplication.

[0130] The dual-layer routing attention processing module 300 is used to perform dual-layer routing attention processing on the integrated labels. First, it dynamically suppresses the feature transmission of irrelevant background regions at the region level, and then enhances the local feature response of the target region at the label level to generate an enhanced feature map containing global semantics and local details.

[0131] The multi-scale feature fusion and detection output module 400 is used to input the enhanced feature map into the neck network for multi-scale feature fusion, and output the class probability and bounding box coordinates of the UAV target by combining the detection head with depthwise separable convolution.

[0132] In one embodiment of the present invention, it further includes a post-processing module for post-processing the bounding box coordinates output by the detection head.

[0133] This invention discloses a small target UAV detection device in complex scenarios. Based on a dual-layer routing attention mechanism, it achieves dynamic sparse perception, effectively addressing the core shortcomings of existing detection schemes, such as inefficient global modeling in complex backgrounds, severe background interference, and the easy submersion of small target features. Through modular collaboration, the device achieves end-to-end optimization from region-level noise filtering and marker-level feature focusing to multi-scale fusion output, significantly improving the detection accuracy and model robustness for small UAV targets. Simultaneously, it greatly reduces computational complexity, enhancing real-time processing capabilities and system deployment efficiency in resource-constrained scenarios such as security monitoring.

[0134] To implement the methods of the above embodiments, the present invention also provides a computer device, such as... Figure 5 As shown, the computer device 600 includes a memory 601 and a processor 602; wherein, the processor 602 reads the executable program code stored in the memory 601 to run a program corresponding to the executable program code, so as to implement the various steps of the small target UAV detection method in a complex scenario described above.

[0135] To implement the above embodiments, this application also proposes a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a method for detecting small target UAVs in complex scenarios as described in the foregoing embodiments.

[0136] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0137] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

Claims

1. A method for detecting small targets using unmanned aerial vehicles (UAVs) in complex scenarios, characterized in that, include: S1, the input image is segmented into multiple coarse-grained regions of fixed size, the affinity matrix between each region is calculated, and highly correlated regions are selected based on the Top-k strategy to construct a region-level correlation map to filter background noise; S2, perform a label collection operation on the fine-grained labels in the selected high-association regions, integrate the labels distributed across regions into a contiguous memory block, and use dense matrix multiplication to complete the label-level attention calculation; S3 performs two-layer routing attention processing on the integrated labels. First, it dynamically suppresses the feature propagation of irrelevant background regions at the region level, and then strengthens the local feature response of the target region at the label level to generate an enhanced feature map containing global semantics and local details. S4 inputs the enhanced feature map into the neck network for multi-scale feature fusion, and combines it with the detection head of depthwise separable convolution to output the class probability and bounding box coordinates of the UAV target.

2. The method as described in claim 1, characterized in that, The process of segmenting the input image into multiple fixed-size coarse-grained regions, calculating the affinity matrix between each region, selecting highly correlated regions based on a Top-k strategy, and constructing a region-level correlation graph to filter background noise includes: S11, the sliding window algorithm is used to divide the input image into non-overlapping fixed-size regions, each region having a size of [missing information]. ;in, and These are the area height and width, respectively; S12, by calculating the cosine similarity of the region feature vectors. Construct an affinity matrix; where, and The first The region and the first The feature vectors of each region are used to retain only the top-ranked regions in terms of similarity. The associated region is connected.

3. The method as described in claim 1, characterized in that, The step of performing a label collection operation on fine-grained labels within the selected high-association regions, integrating cross-regional labels into contiguous memory blocks, and using dense matrix multiplication to complete label-level attention calculation includes: S21, based on the highly correlated regions selected from the regional correlation graph, a spatial location sorting strategy is used to reorganize the scattered markers into contiguous memory blocks according to the regional coordinate order; S22, through formula Calculate the spatial location weight matrix ;in and These are the query vector and the key vector, respectively. is the dimension of the key vector.

4. The method as described in claim 1, characterized in that, The integrated labels undergo a two-layer routing attention process: first, feature propagation in irrelevant background regions is dynamically suppressed at the region level; then, local feature responses in the target region are enhanced at the label level, generating an enhanced feature map containing both global semantics and local details. This includes: S31, Regional-level dynamic suppression is achieved through the formula... To achieve; among which, This is an intermediate feature map. This is the output feature of the first-level pooling; S32, the marker-level local feature response is expressed by the formula... To achieve; among which, and These are the output features of the second and third level pooling, respectively.

5. The method as described in claim 1, characterized in that, The process of inputting enhanced feature maps into the neck network for multi-scale feature fusion, and combining the detection head with depthwise separable convolutions to output the class probability and bounding box coordinates of the UAV target, includes: S41, the neck network adopts a PAN-FPN bidirectional feature fusion architecture, through the formula Achieve high-level feature upsampling; among which, The deep features output by the backbone network; S42, the detection head passes through the formula To achieve bounding box coordinate distribution prediction; where, The first output of the network The probability distribution of each discrete distance interval. This represents the final regression distance.

6. The method as described in claim 1, characterized in that, Also includes: S5 performs post-processing on the bounding box coordinates output by the detection head.

7. A device for detecting small targets using unmanned aerial vehicles (UAVs) in complex scenarios, characterized in that, include: The region segmentation and association graph construction module is used to segment the input image into multiple coarse-grained regions of fixed size, calculate the affinity matrix between each region, and select highly associated regions based on the Top-k strategy to construct a region-level association graph to filter background noise. The label collection and attention calculation module is used to perform label collection operations on fine-grained labels in the selected high-association regions, integrate labels distributed across regions into a contiguous memory block, and complete label-level attention calculation using dense matrix multiplication; The dual-layer routing attention processing module is used to perform dual-layer routing attention processing on the integrated labels. First, it dynamically suppresses the feature propagation of irrelevant background regions at the region level, and then strengthens the local feature response of the target region at the label level to generate an enhanced feature map containing global semantics and local details. The multi-scale feature fusion and detection output module is used to input the enhanced feature map into the neck network for multi-scale feature fusion, and combine it with the detection head with depthwise separable convolution to output the class probability and bounding box coordinates of the UAV target.

8. The apparatus as claimed in claim 7, characterized in that, Also includes: The post-processing module is used to perform post-processing on the bounding box coordinates output by the detection head.

9. An electronic device, comprising: processor; The memory stores executable instructions; when the processor executes the instructions, it implements the method for detecting small targets UAVs in complex scenarios as described in any one of claims 1-6.

10. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements a method for detecting small targets in complex scenarios as claimed in any one of claims 1-6.