A density-guided unmanned aerial vehicle aerial dense small target detection method and device
Patent Information
- Application Number
- CN202611225692.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-13
- Publication Date
- 2026-10-23
AI Technical Summary
[0004]为了解决或部分解决密集场景小目标检测中存在的小目标特征表征不足、目标尺度与空间分布差异大、目标分布密度信息未被有效利用、以及检测精度与计算效率难以兼顾的问题,本发明提供一种密度引导的无人机航拍密集小目标检测方法,包括以下步骤:
[0014]本发明的有益效果为:本发明通过在颈部网络采用密度引导自适应窗口注意力模块,利用目标分布密度图对多种尺度窗口注意力的输出进行门控融合,网络能够依据各区域的目标分布密集程度自适应调节感受野尺度,在密集区域采用较大窗口捕获上下文信息、在稀疏区域采用较小窗口聚焦局部细节,从而兼顾不同密度区域的特征感知,并按目标分布密度分配注意力计算资源,缓解固定结构特征提取难以同时兼顾密集与稀疏目标的问题。同时,由于在检测头采用密度引导调制策略,利用决策层密度图对分类分支与回归分支分别生成调制参数进行仿射调制,使检测决策与目标分布密度相匹配,避免了现有检测器对不同密度区域同等处理所导致的密集遮挡区域漏检与误检。此外,通过局部特征差异化模块采用结构化初始化的双方向深度可分离卷积提取方向梯度,并以可学习残差门控进行融合,增强相邻密集小目标间的判别性边界,缓解小目标特征表征不足的问题。本发明有利于密度引导的目标检测技术在无人机航拍、智能安防、交通监管、灾害应急救援等密集场景中的实际应用。
Smart Images

Figure CN122967157A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of small target detection technology, specifically providing a density-guided method and apparatus for detecting dense small targets in UAV aerial photography. Background Technology
[0002] Unmanned aerial vehicle (UAV) aerial image target detection technology has significant application value in fields such as intelligent security, traffic monitoring, disaster emergency rescue, refined urban management, and low-altitude economy. Aerial images are characterized by a wide field of view and flexible acquisition methods, enabling rapid target discovery and localization in wide-area scenarios. However, targets in aerial images are generally small in scale, densely distributed, and have complex backgrounds, making the detection of dense small targets against complex backgrounds a challenging task.
[0003] In recent years, deep learning-based target detection technology has provided an effective tool for image recognition and detection. However, existing general-purpose target detectors have certain limitations when dealing with the detection of dense small targets in drone aerial photography: First, small targets account for a small proportion of the image, and their effective features are significantly attenuated after multiple downsampling by the backbone network, resulting in insufficient feature representation; Second, aerial images contain targets with large scale spans and uneven spatial distribution, making it difficult for fixed-structure feature extraction and fusion methods to simultaneously take into account both sparse large targets and dense small targets; Third, existing detectors typically use the same processing strategy for regions of different densities, failing to utilize target distribution density information to differentiate feature perception and detection decisions, which easily leads to missed detections and false detections in densely occluded and background interference areas; Fourth, introducing large window attention or multi-branch structures to improve the perception capability of small targets often comes with high computational and memory overhead, making it difficult to meet the real-time requirements of edge platforms such as drones. Summary of the Invention
[0004] To address or partially address the problems in small target detection in dense scenes, such as insufficient small target feature representation, large differences in target scale and spatial distribution, ineffective utilization of target distribution density information, and the difficulty in balancing detection accuracy and computational efficiency, this invention provides a density-guided UAV aerial photography method for detecting dense small targets, comprising the following steps: Step S1: Obtain the image to be detected; Step S2: Input the image to be detected into the detection network, which includes a backbone feature extraction network, a neck feature fusion network, and a detection head; Based on the backbone feature extraction network, the image to be detected is downsampled at multiple levels, and a multi-scale feature map including at least P2 layer feature maps is output. The P2 layer feature map is input into the neck feature fusion network, and then processed sequentially by the local feature differentiation structure and the density-guided adaptive window attention structure set in the P2 layer to output the enhanced P2 layer features. The local feature differentiation structure is used to extract the directional gradient and enhance the boundary features between adjacent targets through learnable residual gating. The density-guided adaptive window attention structure is used to estimate the target distribution density map and guide the weighted fusion of multi-scale window attention through the density map. The enhanced P2 layer features are input into the detection head. The density-guided modulation structure set by the P2 layer performs affine modulation on the classification branch and the regression branch according to the decision layer density map, and outputs the modulated classification features and regression features. Step S3: Output the detection results based on the modulated classification features and regression features.
[0005] Preferably, the local feature differentiation structure uses two-branch depthwise separable convolutions in the horizontal and vertical directions to extract gradient responses respectively. The gradient responses in the horizontal and vertical directions are fused, adjusted by the learnable residual gate, and then added to the input feature residual for output.
[0006] Preferably, the convolution kernels of the depth-separable convolutions in the horizontal direction are initialized with a horizontal Sobel operator, and the convolution kernels of the depth-separable convolutions in the vertical direction are initialized with a vertical Sobel operator, and the initialization is replicated on all input channels of each branch convolution. The relationship between the output of the learnable residual gating and the input feature X is as follows: in Features are derived from directional gradient fusion. These are learnable scalar residual gating parameters.
[0007] Preferably, the density-guided adaptive window attention module includes density map estimation, multi-scale window attention, and density-gated fusion; Estimating the target distribution density map and guiding the weighted fusion of multi-scale window attention using the density map includes: Estimate the target distribution density map based on input features; Window self-attention is calculated using K different scale windows for the input features to obtain window attention features at each scale. The element-wise product of the density map and the input features is used as a condition to generate fusion weights, and the attention features of each scale window are weighted and summed according to the fusion weights and output.
[0008] Preferably, the target distribution density map is as follows: in, Input features; for Convolution is used to aggregate local context; for Convolution is used to compress the number of channels to 1; This represents the Sigmoid function; This is a target distribution density map, used to characterize the density of target distribution at various spatial locations.
[0009] Preferably, the density-guided modulation structure includes decision-level density map estimation and affine modulation; The decision layer density map estimation is used to estimate the decision layer density map based on the P2 layer features input from the detection head: in, Input for the detection head feature, and This constitutes the density estimation branch of the decision layer. This represents the Sigmoid function; Density diagram of the decision-making layer; The affine modulation includes: generating modulation parameters for the classification branch and modulation parameters for the regression branch based on the element-wise product of the decision layer density map and the P2 layer features; performing affine modulation on the classification features of the P2 layer features based on the modulation parameters of the classification branch; and performing affine modulation on the regression features of the P2 layer features based on the modulation parameters of the regression branch.
[0010] Preferably, the modulation parameters of the classification branch and the modulation parameters of the regression branch are respectively: in, and Each branch has its own independent modulation parameter generation network for classification and regression, and its structure consists of two layers. Convolutional concatenation, with the number of output channels being... ; These are conditional features after density gating; This indicates a bisection operation along the channel dimension; , These are the channel-wise scaling parameters and offset parameters for the classification branches, respectively; , These are the channel-wise scaling parameters and offset parameters for the regression branch, respectively.
[0011] Preferably, the modulated classification features and regression features are as follows: in, and These are the modulated classification features and regression features, respectively.
[0012] Secondly, the present invention provides a density-guided drone aerial photography dense small target detection device, comprising: The image acquisition module is used to acquire the image to be detected; The detection module is used to input the image to be detected into the detection network, which includes a backbone feature extraction network, a neck feature fusion network, and a detection head; Based on the backbone feature extraction network, the image to be detected is downsampled at multiple levels, and a multi-scale feature map including at least P2 layer feature maps is output. The P2 layer feature map is input into the neck feature fusion network, and then processed sequentially by the local feature differentiation structure and the density-guided adaptive window attention structure set in the P2 layer to output the enhanced P2 layer features. The local feature differentiation structure is used to extract the directional gradient and enhance the boundary features between adjacent targets through learnable residual gating. The density-guided adaptive window attention structure is used to estimate the target distribution density map and guide the weighted fusion of multi-scale window attention through the density map. The enhanced P2 layer features are input into the detection head. The density-guided modulation structure set by the P2 layer performs affine modulation on the classification branch and the regression branch according to the decision layer density map, and outputs the modulated classification features and regression features. The output module is used to output detection results based on the modulated classification and regression features.
[0013] Thirdly, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described thereon.
[0014] The beneficial effects of this invention are as follows: By employing a density-guided adaptive window attention module in the neck network, this invention uses the target distribution density map to gating and fusing the outputs of multi-scale window attention. The network can adaptively adjust the receptive field scale according to the target distribution density in each region. Larger windows are used in dense regions to capture contextual information, while smaller windows are used in sparse regions to focus on local details, thus taking into account feature perception in regions of different densities. Attention computational resources are allocated according to the target distribution density, alleviating the problem that fixed-structure feature extraction cannot simultaneously handle both dense and sparse targets. Simultaneously, by employing a density-guided modulation strategy in the detection head, modulation parameters are generated for the classification and regression branches using the decision layer density map for affine modulation, ensuring that the detection decision matches the target distribution density. This avoids missed detections and false detections in densely occluded regions caused by existing detectors treating different density regions equally. Furthermore, the local feature differentiation module uses structured initialization of bidirectional depthwise separable convolutions to extract directional gradients and fuses them using learnable residual gating, enhancing the discriminative boundary between adjacent dense small targets and alleviating the problem of insufficient feature representation for small targets. This invention facilitates the practical application of density-guided target detection technology in dense scenarios such as drone aerial photography, intelligent security, traffic monitoring, and disaster emergency rescue. Attached Figure Description
[0015] The disclosure of this invention will become more readily understood with reference to the accompanying drawings. It will be readily understood by those skilled in the art that these drawings are for illustrative purposes only and are not intended to limit the scope of protection of this invention. Furthermore, similar numbers in the drawings are used to denote similar components, wherein: Figure 1 This is a schematic diagram of a density-guided drone aerial photography dense small target detection device according to an embodiment of the present invention.
[0016] Figure 2 This is a schematic diagram of a deep learning network according to an embodiment of the present invention.
[0017] Figure 3 This is a schematic diagram of the Deformable Multi-Scale Feature Enhancement Module (DMMSFEM) architecture according to an embodiment of the present invention.
[0018] Figure 4 This is a schematic diagram of the Local Feature Differentiation Module (LFDM) architecture according to an embodiment of the present invention.
[0019] Figure 5 This is a schematic diagram of the density-guided adaptive window attention module architecture according to an embodiment of the present invention.
[0020] Figure 6 This is a schematic diagram of the density-guided modulation detection head module architecture according to an embodiment of the present invention.
[0021] Figure 7 This is a schematic flowchart of a density-guided UAV aerial photography method for detecting dense small targets according to an embodiment of the present invention. Detailed Implementation
[0022] Some embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.
[0023] like Figure 1-7 As shown, this invention provides a density-guided method for detecting dense small targets in UAV aerial photography, comprising the following steps: Step S1, as follows Figure 1 As shown, the image acquisition terminal 103 mounted on the UAV continuously captures images of the work area, obtains aerial images of dense scenes from multiple perspectives, and establishes a dataset of dense small targets containing complex working conditions.
[0024] The aforementioned acquisition terminal is mounted on the UAV 102 and is responsible for continuously capturing images of the work area 104; the computing and analysis platform 101 processes the image data and outputs the location boundaries, categories and classification confidence of each target in the dense scene based on the built-in density-guided detection algorithm.
[0025] Complex operating conditions include dense target occlusion, small-scale targets, complex backgrounds, and varying illumination. Let the total number of samples be... The dimension of a single frame image is defined as follows: ,in, Indicates the number of image channels. Indicates the image height. The image width is represented. Labeling software is used to define the true boundaries of each target and assign category labels. After data processing, the dataset is divided into a training subset and a validation subset.
[0026] Step S2: Input the image to be detected into the detection network, which includes a backbone feature extraction network, a neck feature fusion network, and a detection head; Step S2.1, as follows Figure 2 As shown, a density-guided small target detection network model for dense scenes is constructed. The model includes a backbone feature extraction network, a neck feature fusion network, and a density-guided modulation detection head.
[0027] Among them, the backbone feature extraction network in Layers are configured with deformable multi-scale feature enhancement modules; the neck feature fusion network is used in... The layers are sequentially configured with a local feature differentiation module and a density-guided adaptive window attention module; the detection head pairs The classification and regression branches of the layer perform density-guided modulation. Given a preprocessed input image: in, Indicates batch size. This represents the number of channels for the input feature; Indicates the height of the input feature; This represents the width of the input feature. After the input image is downsampled at multiple levels by the backbone network, a multi-scale feature map is obtained. .
[0028] Step S2.2: To adapt to the multi-scale and geometric deformation characteristics of dense small targets, in the backbone network... The layer is configured with four parallel branches, such as Figure 3 As shown. The calculation process is as follows: in, For superficial transmission of the skeletal system Feature tensor; Indicates the first Road feature extraction branch; Indicates the first Feature map of the branch output.
[0029] Specifically, Four parallel branches , , , right The output features obtained after feature extraction. Among them, for Point convolution branch; for Local branch; for Context branches; Expansion rate of Large sensory field branch.
[0030] Furthermore, , , All are implemented using deformable convolution. Each of the four branches outputs... Each channel, after being stitched together along its dimension, Merging convolutions restores to One channel. This indicates a splicing operation along the channel dimension; express Merge convolutions; For multi-scale enhancement Features. Specifically, the sampling positions and modulation masks of the deformable convolution are generated by offset and mask prediction convolution: in, The offset and mask prediction convolution has the following output channels: , The area of the convolution kernel; This is the concatenation tensor of the offset and the mask; For two-dimensional sampling offset, take The former One channel; To obtain a learnable modulation mask, take After Each channel is mapped to a sigmoid function. interval; This represents the Sigmoid function; These are deformable convolution weights; This represents deformable convolution operation with modulation mask; This is a single-branch deformable convolution output. After batch normalization and SiLU activation, it serves as the final output of the corresponding deformable convolution branch.
[0031] Step S2.3: To enhance the discriminative boundary between adjacent dense small targets, in the neck network... The layer is configured with a bidirectional gradient extraction and residual fusion structure, such as Figure 4 As shown.
[0032] The calculation process is as follows: in, Input features; and The depths in the horizontal and vertical directions are separable. Convolutional kernels are structured and initialized using the Sobel operator, and remain learnable during training. This indicates a splicing operation along the channel dimension; This indicates that the number of channels will be changed from... Compress back Fusion convolution; Indicates batch normalization; This represents a nonlinear activation function, and the three are applied sequentially to the concatenated gradient feature; Features are derived from directional gradient fusion. To be a learnable scalar residual gating parameter, the initial value is taken as... ; This represents the Sigmoid function; This is the output after local feature differentiation enhancement.
[0033] The structured initialization kernels in the horizontal and vertical directions are as follows: in, It is a horizontal Sobel kernel used to extract the gradient response in the horizontal direction; This is a vertical Sobel kernel used to extract the gradient response in the vertical direction. Both are replicated and initialized on all input channels of the depthwise separable convolution.
[0034] As an alternative embodiment, the gradient extraction direction is not limited to the horizontal and vertical directions. A branch in the diagonal direction can also be added. The gradient responses in the four directions of horizontal, vertical, 45° and 135° are concatenated along the channel dimension and then compressed by fusion convolution to obtain multi-directional gradient fusion features.
[0035] As an alternative embodiment, the depthwise separable convolution can be replaced by conventional convolution or grouped convolution. Based on the structured initialization of the convolution kernel with the Sobel operator, it can also achieve directional gradient response extraction, and the convolution type can be flexibly selected according to computational resource constraints.
[0036] Step S2.4: The density-guided adaptive window attention module is set in the neck network. The module comprises three parts: density map estimation, multi-scale window attention, and density-gated fusion. Figure 5 As shown. The density map estimation process is as follows: in, For input features; for Convolution is used to aggregate local context; for Convolution is used to compress the number of channels to 1; This represents the Sigmoid function; This is a target distribution density map, used to characterize the density of target distribution at various spatial locations.
[0037] For the input features respectively Window self-attention modeling for windows of different sizes: in, Indicates the number of window sizes; Indicates the first Window self-attention branches corresponding to different window scales; Representing input features After the first Output features obtained after window self-attention modeling at various window scales.
[0038] The attention output at each scale window maintains the same spatial size and number of channels as the input features, i.e.: The window size in the above formula is taken from the set. That is, when At that time, the four window self-attention branches are as follows: in, Indicates the window size; , , , These represent window sizes of 1000 and 1000 respectively. , , , The window attention output features are obtained at that time. The calculation process of single-window attention is as follows: first, the input feature map is filled according to the corresponding window scale and divided into non-overlapping windows; then, self-attention calculation is performed within each window. For the first... Let the window size be a certain type of window. Features within a single window are denoted as Then, the following operation will be performed within this window: in, Features within a single window; Used to generate queries, keys, and values; This indicates a partitioning operation along the channel dimension, resulting in the query. ,key Sum ; The scaling factor is the reciprocal of the square root of the key dimension; It is a normalized exponential function; This is the attention weight matrix within the window; Indicates matrix transpose; For output projection convolution; This is a single-window attention output. After inverse window partitioning and padding / clipping, the attention output at the corresponding scale is restored. .
[0039] Step S2.5: Using the element-wise product of the density map and the features as a condition, generate the spatial dimension fusion weights: in, The input features for the density-guided adaptive window attention module have the following dimensions: , The density map obtained from the density estimation branch has the following dimensions: . This indicates element-wise multiplication; These are conditional features after density map gating; and Two layers in series Convolution, the latter has 100 output channels. ; along The dimensions are normalized so that the sum of the fusion weights corresponding to each spatial location is 1. The fusion weights are for different window sizes. For the first Pixel-wise fusion weights at various window scales; For the first Attention output at various window scales; ultimately, The weighted attention outputs at each scale are summed to obtain the final output of the density-guided adaptive window attention module. In the density map estimation branch and the fusion weight generation branch, the number of intermediate hidden channels can be denoted as: in, Indicates rounding down. Indicates taking and The larger value in Indicates the number of channels in the intermediate hidden layer. This represents the channel compression ratio.
[0040] Step S2.6: The detection head independently estimates the density map at the decision level, and then uses this density map to... The classification and regression branches of the layer are respectively subjected to affine modulation. This modulation only applies to... Layer, i.e. The remaining detection layers remain unchanged. The density map estimation process is as follows: The modulation parameters for the classification branch and the regression branch are as follows: in, Input for the detection head feature; and This constitutes the branch for density estimation at the decision-making level. This represents the Sigmoid function; Density diagram of the decision-making layer; The modulated classification and regression features are as follows: in, and Each branch has its own independent modulation parameter generation network for classification and regression, and its structure consists of two layers. Convolutional concatenation, with the number of output channels being... ; These are conditional features after density gating; This indicates a bisection operation along the channel dimension; , These are the channel-wise scaling parameters and offset parameters for the classification branches, respectively; , These are the channel-wise scaling parameters and offset parameters of the regression branch, respectively; and These are the modulated classification features and regression features, respectively.
[0041] In the decision-level density estimation branch and the modulation parameter generation network, the number of intermediate hidden channels can be denoted as: in, Indicates rounding down. Indicates taking and The larger value in Indicates the number of channels in the intermediate hidden layer. This represents the channel compression ratio. Both sets of modulation parameter generation networks use identical initialization, i.e. The initial value is set to 1. The initial value is set to 0, so that the initial state satisfies: Then, the detection output is executed: in, For classification and prediction networks; For bounding box regression prediction network; Indicates the classification confidence level of each objective; This indicates the location boundaries of each target.
[0042] Step S3, the training process includes The network undergoes several iterations. The detection network employs an end-to-end detection mode, with simultaneous supervision of both the one-to-many and one-to-one branches during the training phase: the one-to-many branch provides dense supervision under many-to-one label assignment, while the one-to-one branch provides sparse supervision under one-to-one label assignment. The losses for both branches include bounding box regression loss and classification loss, which are jointly optimized to support end-to-end output during the inference phase. Since the number of output channels for the bounding box regression head is set to 1, the bounding box uses direct regression to predict its offset relative to the anchor point, without enabling the distributed focus loss term. The set training hyperparameters include the initial learning rate. Batch size The input image size (640×640), the segmentation ratio of the training and validation subsets, and the optimizer type are specified. During training, a copy-paste and mosaic data augmentation strategy is employed, with mosaic augmentation disabled in the later stages of iteration to stabilize bounding box regression. In the backpropagation phase, the local feature differentiation module uses Sobel operator-structured initialized depthwise separable convolutional kernels, residual gating parameters, and channel-wise scale parameters from the density-guided modulation detector head. With offset parameter All parameters are learned parameters and participate in gradient updates along with the other parameters of the network, thereby enabling the density-guided mechanism to jointly optimize the strength of its role in the perception and decision-making ends and the detection task.
[0043] The trained detection network is used to predict the image under test, and outputs the bounding box coordinates, class confidence and class index of each target in the dense scene.
[0044] One possible density-guided method for detecting dense small targets in UAV aerial photography includes: uniformly adjusting the target image to 640×640 pixels and inputting it into the network. The image undergoes multi-scale feature extraction via a backbone network, where... Layer features are enhanced by a deformable multi-scale feature enhancement module to improve the feature representation capability of multi-scale and geometrically deformable targets. The extracted multi-scale features are input into the neck network. Layer features are sequentially enhanced by a local feature differentiation module to improve the discriminative boundaries between adjacent dense targets, and then by a density-guided adaptive window attention module to adaptively adjust the receptive field scale according to the target distribution density, subsequently... , Layer features are fused across scales to output , , Feature maps at three scales. With a 640×640 input, the spatial dimensions of the feature maps at the three scales are 160×160, 80×80, and 40×40, corresponding to strides of 4, 8, and 16, respectively, used to detect targets of different sizes. The feature map input density guides the modulation detection head: the detection head... The layer performs affine modulation on the classification and regression branches based on the decision layer density map; the regression branch outputs the offset of the bounding box relative to the anchor point, and the classification branch outputs the raw scores of each category. The outputs from each scale of the detector head are stitched together and uniformly organized into a representation where the total number of predicted points across the three scales is the number of predicted points. Under a 640×640 input, the total number of predicted points is... During the inference phase, the regression branch output is decoded by combining the anchor point and the step size at each scale, and restored to the network input scale to obtain the bounding box coordinates. A sigmoid activation function is applied to the classification branch output to obtain the confidence score for each category. In end-to-end mode, the network uses a one-to-one branch output, and selects the top-k predictions based on the confidence score as the final detection results, with the number of outputs not exceeding the preset maximum number of detections. This replaces non-maximum suppression; in an optional implementation, non-maximum suppression can also be combined to further remove overlapping detection boxes. Based on the scaling and padding relationship in the preprocessing stage, the detection box coordinates are restored from the network input scale of 640×640 to the original image scale, outputting detection results including bounding box coordinates, confidence scores, and class indices, with the final output detection box count not exceeding the maximum detection count. The detection box coordinates are then converted to normalized position coordinates. The image is then overlaid and displayed on the test image. If at least one valid detection box is obtained, the corresponding target is determined to exist; if no valid detection box is obtained, the target is determined not to be detected. The density-guided modulation detection head is used to... Differential modulation of layer classification and regression branches, and adaptive adjustment of receptive field scale for different density regions by density-guided adaptive window attention, enable feature perception and detection decision of small targets in densely occluded scenes to be matched with the target distribution, thereby improving the detection integrity of dense small targets.
[0045] The comparison results of the proposed method (Ours) with other state-of-the-art methods are shown in Table 1. The comparison results of the proposed method (DG-Net) with other state-of-the-art methods are shown in Table 1. In terms of precision (P), recall (R), mAP@.50, and mAP@.50:.95, the proposed method achieves the best results: mAP@.50 reaches 0.409, an improvement of 3.0 percentage points compared to the second-best Gold-YOLO (0.379); mAP@.50:.95 reaches 0.24, an improvement of 1.6 percentage points compared to the second-best DAU-YOLO (0.224); precision and recall reach 0.531 and 0.415 respectively, improvements of 5.2 and 4.2 percentage points respectively compared to the second-best Gold-YOLO. Regarding model complexity, the method of this invention reduces the number of parameters to 2.11M, the lowest among all compared methods, and approximately 11.3% lower than DAU-YOLO and YOLOv26n (both with 2.38M), which have the second lowest number of parameters. The aforementioned improvement in accuracy and reduction in parameters demonstrate that the density-guided mechanism is effective in differentiating the perception and detection decisions of dense small target features. It should be noted that the computational cost of the method of this invention is 23.2 GFLOPs, higher than some lightweight compared methods. This overhead mainly stems from the multi-scale window attention and deformable multi-scale convolutions in the P2 high-resolution layer. Despite this computational cost, the inference speed of the method of this invention still reaches 384.6 FPS, meeting the requirements for real-time detection and outperforming amsf-YOLO11 (285.7 FPS), Gold-YOLO (227.3 FPS), and UAV-STD (156.2 FPS). In summary, the method of this invention outperforms existing methods in terms of detection accuracy and parameter quantity, and maintains real-time inference capability with acceptable computational overhead, verifying the effectiveness and practicality of density-guided small target detection method in dense scenes.
[0046] Table 1. Quantitative comparison of the method of this invention with other methods.
[0047] The ablation experiments of the method (Ours) of this invention are shown in Table 2. To verify the effectiveness of each module, the method of this invention gradually added a deformable multi-scale feature enhancement module (DM-MSFEM), a local feature differentiation module (LFDM), a density-guided adaptive window attention module (ASWA), and a density-guided modulation detection head (DensityDetect) to the baseline. The ablation experiment results are shown in Table 2.
[0048] After adding DM-MSFEM, mAP@.50 increased from 0.360 to 0.386 (+2.6 percentage points), and mAP@.50:.95 increased from 0.211 to 0.229 (+1.8 percentage points), indicating that the multi-scale deformable feature enhancement improved the feature representation of dense small targets. This module also increased the computational cost from 7.6 GFLOPs to 17.0 GFLOPs, the largest increase among all modules. Adding LFDM further improved mAP@.50 to 0.392 (+0.6 percentage points), with only a 0.01M increase in parameters and a 0.5 GFLOPs increase in computation, indicating that bidirectional gradient differentiation improved the discriminative boundary of adjacent dense targets at a relatively low complexity cost. Further addition of ASWA improved mAP@.50 to 0.399 (+0.7 percentage points) and recall from 0.404 to 0.410, indicating that density-guided multi-scale window attention adaptively adjusts the receptive field according to the target distribution density, improving the detection capability of dense regions. Finally, adding DensityDetect improved mAP@.50 to 0.409 (+1.0 percentage point) and precision from 0.515 to 0.531 (+1.6 percentage points), achieving the largest improvement in precision among all modules, while increasing the number of parameters by only 0.02M and the computation by only 1.4 GFLOPs. This indicates that density-guided detector head modulation reduces false detections in densely occluded regions without significantly increasing complexity. Compared to the baseline, the complete model improved mAP@.50 and mAP@.50:.95 by 4.9 and 2.9 percentage points, respectively, with an increase of 0.32M parameters. The LFDM and DensityDetect modules contributed a 1.6 percentage point improvement in mAP@.50 and a 1.7 percentage point improvement in accuracy, with a combined parameter increment of approximately 0.03M and a computation increment of 1.9GFLOPs. This indicates that the density-guided mechanism has a high benefit for dense small target detection under light constraints.
[0049] Table 2 Comparison of ablation experiments using the method of the present invention
[0050] Example 2 A density-guided drone aerial photography device for detecting dense small targets, comprising: The image acquisition module is used to acquire the image to be detected; The detection module is used to input the image to be detected into the detection network, which includes a backbone feature extraction network, a neck feature fusion network, and a detection head; The backbone feature extraction network performs multi-level downsampling on the image to be detected and outputs a multi-scale feature map that includes at least a P2 layer feature map. The P2 layer feature map is input into the neck feature fusion network, and is processed sequentially by the local feature differentiation structure and the density-guided adaptive window attention structure set in the P2 layer, outputting the enhanced P2 layer features; the local feature differentiation structure is used to extract the directional gradient and enhance the boundary features between adjacent targets through learnable residual gating; the density-guided adaptive window attention structure is used to estimate the target distribution density map, and guides the weighted fusion of multi-scale window attention through the density map; The enhanced P2 layer features are input into the detection head. The density-guided modulation structure set by the P2 layer performs affine modulation on the classification branch and the regression branch according to the decision layer density map, and outputs the modulated classification features and regression features. The output module is used to output detection results based on the modulated classification and regression features.
[0051] Example 3 A computer-readable storage medium is characterized in that it stores a computer program, which, when executed by a processor, implements a density-guided method for detecting dense small targets in UAV aerial photography.
[0052] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the original technical features, and the technical solutions resulting from these changes or substitutions will all fall within the scope of protection of the present invention.
Claims
1. A density-guided method for detecting dense small targets in UAV aerial photography, characterized in that, Includes the following steps: Step S1: Obtain the image to be detected; Step S2: Input the image to be detected into the detection network, which includes a backbone feature extraction network, a neck feature fusion network, and a detection head; Based on the backbone feature extraction network, the image to be detected is downsampled at multiple levels, and a multi-scale feature map including at least P2 layer feature maps is output. The P2 layer feature map is input into the neck feature fusion network, and then processed sequentially by the local feature differentiation structure and the density-guided adaptive window attention structure set in the P2 layer to output the enhanced P2 layer features; the local feature differentiation structure is used to extract the directional gradient and enhance the boundary features between adjacent targets through learnable residual gating; The density-guided adaptive window attention structure is used to estimate the target distribution density map and guides the weighted fusion of multi-scale window attention through the density map; The enhanced P2 layer features are input into the detection head. The density-guided modulation structure set by the P2 layer performs affine modulation on the classification branch and the regression branch according to the decision layer density map, and outputs the modulated classification features and regression features. Step S3: Output the detection results based on the modulated classification features and regression features.
2. The method according to claim 1, characterized in that, The local feature differentiation structure uses two-branch depthwise separable convolutions in the horizontal and vertical directions to extract gradient responses. The gradient responses in the horizontal and vertical directions are fused, then adjusted by the learnable residual gate, and finally added to the input feature residual for output.
3. The method according to claim 2, characterized in that, The horizontally depth-separable convolution kernels are initialized with a horizontal Sobel operator, and the vertically depth-separable convolution kernels are initialized with a vertical Sobel operator. The two-branch convolutions replicate the initialization on all their respective input channels. The relationship between the output of the learnable residual gating and the input feature X is as follows: in Features are derived from directional gradient fusion. These are learnable scalar residual gating parameters.
4. The method according to claim 1, characterized in that, The density-guided adaptive window attention module includes density map estimation, multi-scale window attention, and density-gated fusion. Estimating the target distribution density map and guiding the weighted fusion of multi-scale window attention using the density map includes: Estimate the target distribution density map based on input features; Window self-attention is calculated using K different scale windows for the input features to obtain window attention features at each scale. The element-wise product of the density map and the input features is used as a condition to generate fusion weights, and the attention features of each scale window are weighted and summed according to the fusion weights and output.
5. The method according to claim 4, characterized in that, The target distribution density map is as follows: in, Input features; for Convolution is used to aggregate local context; for Convolution is used to compress the number of channels to 1; This represents the Sigmoid function; This is a target distribution density map, used to characterize the density of target distribution at various spatial locations.
6. The method according to claim 1, characterized in that, The density-guided modulation structure includes decision-level density map estimation and affine modulation; The decision layer density map estimation is used to estimate the decision layer density map based on the P2 layer features input from the detection head: in, Input for the detection head feature, and This constitutes the density estimation branch of the decision layer. This represents the Sigmoid function; Density diagram of the decision-making layer; The affine modulation includes: generating modulation parameters for the classification branch and modulation parameters for the regression branch based on the element-wise product of the decision layer density map and the P2 layer features; performing affine modulation on the classification features of the P2 layer features based on the modulation parameters of the classification branch; and performing affine modulation on the regression features of the P2 layer features based on the modulation parameters of the regression branch.
7. The method according to claim 6, characterized in that, The modulation parameters of the classification branch and the regression branch are respectively: in, and Each branch has its own independent modulation parameter generation network for classification and regression, and its structure consists of two layers. Convolutional concatenation, with the number of output channels being... ; These are conditional features after density gating; This indicates a bisection operation along the channel dimension; , These are the channel-wise scaling parameters and offset parameters for the classification branches, respectively; , These are the channel-wise scaling parameters and offset parameters for the regression branch, respectively.
8. The method according to claim 7, characterized in that, The modulated classification and regression features are as follows: in, and These are the modulated classification features and regression features, respectively.
9. A density-guided UAV aerial photography device for detecting dense small targets, characterized in that, include: The image acquisition module is used to acquire the image to be detected; The detection module is used to input the image to be detected into the detection network, which includes a backbone feature extraction network, a neck feature fusion network, and a detection head; Based on the backbone feature extraction network, the image to be detected is downsampled at multiple levels, and a multi-scale feature map including at least P2 layer feature maps is output. The P2 layer feature map is input into the neck feature fusion network, and then processed sequentially by the local feature differentiation structure and the density-guided adaptive window attention structure set in the P2 layer to output the enhanced P2 layer features; the local feature differentiation structure is used to extract the directional gradient and enhance the boundary features between adjacent targets through learnable residual gating; The density-guided adaptive window attention structure is used to estimate the target distribution density map and guides the weighted fusion of multi-scale window attention through the density map; The enhanced P2 layer features are input into the detection head. The density-guided modulation structure set by the P2 layer performs affine modulation on the classification branch and the regression branch according to the decision layer density map, and outputs the modulated classification features and regression features. The output module is used to output detection results based on the modulated classification and regression features.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 8.