An unmanned aerial vehicle remote sensing image target detection model and a lightweight deployment method thereof
Patent Information
- Application Number
- CN202611072103.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-20
- Publication Date
- 2026-10-13
AI Technical Summary
[0008]本发明实施方式的目的是提供一种无人机遥感图像目标检测模型及系统,以至少解决现有技术存在着复杂场景定位稳定性不足以及参数量与计算开销偏高的问题
[0049]1、本发明的目标检测模型采用RT-DETR构架,所述骨干网络的浅层阶段以及深层阶段均嵌入有CSP模块,能够显著降低的计算量提升多尺度特征一致性与小目标可检性,为后续特征融合与解码预测提供更具判别性的输入特征;
Smart Images

Figure CN122906584A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of target detection, and more specifically to a target detection model for UAV remote sensing images and its lightweight deployment method. Background Technology
[0002] In recent years, unmanned aerial vehicle (UAV) platforms have been widely used in fields such as urban refined management, traffic inspection, security monitoring, emergency disaster relief assessment, and agricultural and forestry monitoring due to their advantages of maneuverability, convenient deployment, and ability to acquire high-resolution images at close range. Compared with satellite remote sensing and manned aerial remote sensing, UAV remote sensing has significant advantages in terms of timeliness, perspective flexibility, and mission organization costs, enabling it to rapidly generate high-frequency, multi-source, and multi-scale observation data in complex environments and emergency missions. With the improvement of sensor resolution and the expansion of mission scale, the acquisition and accumulation of UAV remote sensing image data has shown a rapid growth trend, driving an urgent need for automated and intelligent image understanding methods.
[0003] Target detection, a crucial foundational task in UAV remote sensing image understanding, provides structured information for downstream tasks such as target statistical analysis, target tracking, risk assessment, and decision support. Its detection accuracy and efficiency directly impact the reliability and usability of related applications. In recent years, deep learning methods have significantly propelled the development of target detection technology: from candidate box paradigms represented by two-stage detectors, to single-stage real-time detectors like the YOLO series, and then to end-to-end detection frameworks based on Transformers, detectors have continuously evolved in terms of feature modeling capabilities, end-to-end training consistency, and deployment forms. In particular, real-time Transformer detectors, such as RT-DETR, offer a new technical path that balances global modeling and inference efficiency, laying the methodological foundation for efficient target detection research in UAV remote sensing scenarios.
[0004] However, the existing RT-DETR still has several limitations when used directly for aerial photography missions:
[0005] First, the backbone network downsampling is prone to losing small target details, and spatial misalignment and inconsistent contextual semantics occur when multi-scale feature fusion, resulting in insufficient stability of localization in complex scenes.
[0006] Second, the model encoder and decoder have complex structures, high parameter count and computational overhead, making them difficult to deploy directly on airborne edge devices such as Jetson Orin Nano.
[0007] Third, conventional structured pruning will destroy the prediction logic of multi-decoder layer-by-layer refinement after pruning channels, resulting in a significant decrease in accuracy. General distillation only aligns the final output and cannot repair the multi-layer inference degradation problem. Summary of the Invention
[0008] The purpose of this invention is to provide a target detection model and system for UAV remote sensing images, so as to at least solve the problems of insufficient positioning stability in complex scenes and high parameter quantity and computational cost in the existing technology.
[0009] To achieve the above objectives, the first aspect of the present invention provides a target detection model for UAV remote sensing images, wherein the target detection model adopts an RT-DETR architecture, the RT-DETR architecture comprising a backbone network and an encoder connected in sequence;
[0010] Both the shallow and deep stages of the backbone network embed CSP modules. The CSP modules are used to divide the input features into two branches, perform feature transformation on the features of one branch, and perform fusion on the features output from the two branches. In one branch of the CSP module in the deep stage, a single-head self-attention transformation unit is embedded. The single-head self-attention transformation unit includes a deep convolutional layer for local feature aggregation and conditional location embedding, a single-head self-attention layer for modeling the global context, and an enhanced convolutional linear gated layer for channel interaction.
[0011] The encoder's CCFF module embeds a dual-scale feature calibration module, which performs context and spatial co-calibration on the multi-layer fusion features output by the CCFF module.
[0012] Preferably, the convolution stem of the backbone network of the RT-DETR architecture uses two consecutively stacked 3×3 convolutional layers, and the stride of the two 3×3 convolutional layers is 2.
[0013] Preferably, the dual-scale feature calibration module includes a context feature calibration submodule and a spatial feature calibration submodule. The CCFF module includes three fusion nodes. The context feature calibration submodule is connected to the third fusion node, and the spatial feature calibration submodule is connected to the first fusion node and the context feature calibration submodule, respectively.
[0014] The context feature calibration submodule is used to: aggregate the high-level feature map output by the third fusion node through pyramid pooling to enhance the semantic consistency and saliency of the high-level feature map based on the attention mechanism, thereby improving the cross-scale context information.
[0015] The spatial feature calibration submodule is used to perform dynamic spatial correction on the input feature map based on a deformable alignment strategy. The feature map input to the spatial feature calibration submodule is the context-corrected feature map output by the context feature calibration submodule and the low-level feature map output by the first fusion node.
[0016] Preferably, the context feature calibration submodule includes:
[0017] The multi-scale context extraction layer is used to perform adaptive average pooling operations on high-level feature maps at different scales based on the improved parallel pyramid pooling module to obtain pooled features at different scales; the pooled features at different scales are concatenated along the spatial dimension to form a multi-scale context descriptor.
[0018] The dynamic attention fusion layer is used to perform adaptive fusion of multi-scale context descriptors based on the cross-attention mechanism to obtain preliminary fused features.
[0019] The local spatial refinement layer is used to enhance the preliminary fused features based on the local attention mechanism to obtain enhanced fused features. The enhanced fused features are then connected to the high-level feature map through residual concatenation to obtain the context-corrected feature map.
[0020] Preferably, the deformable alignment strategy is as follows:
[0021] The context-corrected feature map is convolutionally compressed and then bilinearly upsampled and scaled to the same resolution as the low-level features to obtain the processed high-level features.
[0022] Convolutional enhancement is performed on the low-level feature map to obtain the enhanced low-level features;
[0023] The processed high-level features and the enhanced low-level features are spliced and fused along the channel dimension to obtain a fused feature map;
[0024] The fused feature map is input into a cascaded convolutional network to predict low-level offsets, high-level offsets, and attention coefficients.
[0025] Based on the grouped deformable convolution mechanism, the processed high-level features and the enhanced low-level features are divided into G decoupled subspaces. The grid coordinate normalization process is performed on each decoupled subspace to generate the basic sampling grid.
[0026] The low-level offset and high-level offset are superimposed on the base mesh to obtain deformed sampling points, and bilinear interpolation correction is performed on the deformed sampling points to obtain the corrected high-level features and low-level features.
[0027] Based on the attention coefficient, attention fusion weights are generated. Weighted fusion is then performed on the corrected high-level features and low-level features based on the attention fusion weights to obtain spatially calibrated fused features.
[0028] Preferably, the loss function of the target detection model is the Focaler-MPDIoU loss function, which is jointly constructed from MPDIoU and Focaler-IoU.
[0029] Preferably, the channel interaction of the enhanced convolutional linear gated layer is as follows:
[0030] The features input to the enhanced convolutional linear gated layer are mapped and divided into two branches through a 1×1 convolution, resulting in two branch features;
[0031] One of the branch features is processed by a 3×3 dilated convolution and a nonlinear transformation of the GELU activation function to obtain the branch output feature;
[0032] Based on the gating mechanism, the branch output features are modulated element-wise with another branch to obtain the branch fusion features;
[0033] The branch fusion features are mapped to the output through a 1×1 convolution to obtain the channel interaction features.
[0034] Secondly, the present invention provides a lightweight deployment method for the above-mentioned UAV remote sensing image target detection model, the method comprising:
[0035] The target detection model is pruned based on a preset pruning algorithm to obtain a pruned model.
[0036] During the training phase, the object detection model is used as the teacher model and the pruning model is used as the student model. The pruning model is distilled based on the multi-decoder prediction logic distillation strategy, and the distillation process is supervised based on the weighting mechanism of the teacher prediction confidence of the teacher model, resulting in a lightweight model after distillation.
[0037] Preferably, the multi-decoder prediction logic distillation strategy is as follows:
[0038] The teacher model and the student model generate classification scores and bounding boxes respectively in the corresponding prediction stage;
[0039] Based on the weighting mechanism of teachers' prediction confidence, the weight of teachers' confidence is calculated layer by layer;
[0040] Based on teacher confidence weights, three types of single-stage distillation loss are constructed hierarchically: boundary L1 distillation loss, GIoU distillation loss, and classification BCE distillation loss.
[0041] Hierarchical weighted fusion is performed on the three types of single-stage distillation losses to obtain the global distillation loss of the multi-decoder;
[0042] Obtain the raw detection loss of the teacher model, and determine the total loss of the student model based on the global distillation loss of the multi-decoder and the raw detection loss;
[0043] Based on the total loss of the student model, backpropagation is used to update all parameters of the student model to obtain the distilled lightweight model.
[0044] Preferably, the weighting mechanism for the teacher's prediction confidence is as follows:
[0045] Extract the classification output of the teacher model in the l-th prediction stage;
[0046] Generate the target confidence score based on the classification output of the l-th prediction stage;
[0047] Teacher confidence weights are generated based on the target confidence level.
[0048] The beneficial effects of this invention are:
[0049] 1. The target detection model of the present invention adopts the RT-DETR architecture. The shallow and deep stages of the backbone network are embedded with CSP modules, which can significantly reduce the amount of computation, improve the consistency of multi-scale features and the detectability of small targets, and provide more discriminative input features for subsequent feature fusion and decoding prediction.
[0050] 2. This invention embeds single-head self-attention transformation units in the deep stages of the backbone network, applying single-head self-attention to only a subset of the input channels while leaving other channels unchanged. This method not only eliminates the computational redundancy caused by multi-head attention mechanisms but also reduces memory access costs and computational load by processing only a subset of channels. Furthermore, focusing on a subset of input channels helps the model better focus on representative channels and important features, avoiding interference from irrelevant features, thereby improving the model's learning efficiency and performance.
[0051] 3. The enhanced convolutional linear gated layer of the single-head self-attention transformation unit of the present invention can enhance the ability to express spatial details while ensuring computational efficiency, and provide more discriminative feature representation for multi-scale target detection in UAV remote sensing scenarios;
[0052] 4. The present invention embeds a dual-scale feature calibration module in the CCFF module of the encoder. The dual-scale feature calibration module performs context and spatial collaborative calibration on the multi-layer fusion features output by the CCFF module, which enables the model to detect targets more stably and improve positioning accuracy in dense small target scenes.
[0053] 5. When deploying the target detection model, this invention first prunes the target detection model, then uses a multi-decoder prediction logic distillation strategy to distill the pruned model, and supervises the distillation process based on the weighted mechanism of the teacher prediction confidence of the teacher model. This allows the lightweight model after distillation to retain most of the detection performance with extremely low storage and computational overhead, which is superior to traditional solutions such as feature distillation and single-layer distillation. It can provide a lightweight, high-precision, and deployable edge detection solution for UAV intelligent perception tasks such as traffic inspection, disaster early warning, and low-altitude security. Attached Figure Description
[0054] The accompanying drawings are provided to further illustrate embodiments of the present invention and form part of the specification. They are used together with the following detailed description to explain the embodiments of the present invention, but do not constitute a limitation thereof. In the drawings:
[0055] Figure 1 This is a schematic diagram of the overall architecture of the UAV remote sensing image target detection model provided by the present invention;
[0056] Figure 2 This is a schematic diagram of the backbone network provided by the present invention.
[0057] Figure 3 This is a schematic diagram of the structure of the convolution stem provided by the present invention;
[0058] Figure 4 These are the mAP convergence comparison curves of different ablation models of this invention;
[0059] Figure 5 This is a flowchart of the deployment method of the present invention;
[0060] Figure 6 This is a graph showing the variation of mAP@0.5 and GFLOPs under different compression ratios for LAMP pruning. Detailed Implementation
[0061] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in conjunction with the accompanying drawings and descriptions of the embodiments or the prior art. Obviously, the following description of the structure of the accompanying drawings is only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. It should be noted that the description of these embodiments is for the purpose of helping to understand the present invention, but does not constitute a limitation of the present invention.
[0062] Example 1
[0063] RT-DETR is a real-time end-to-end object detection model, short for Real-Time Detection Transformer. Based on the Transformer architecture, it achieves real-time inference speed while maintaining high accuracy. The RT-DETR architecture includes a backbone network, encoder, decoder, and detection head; the backbone network, encoder, decoder, and detection head are connected in sequence, and the encoder is a high-efficiency hybrid encoder.
[0064] RT-DETR inherits the ensemble prediction and Hungarian matching training mechanisms of DETR, enabling end-to-end object detection. It eliminates the need for NMS post-processing during inference, reducing the overhead of filtering duplicate bounding boxes in dense object scenes and simplifying the deployment process. Secondly, RT-DETR decouples multi-scale features through an efficient hybrid encoder, reducing computational complexity while maintaining the global modeling capabilities of the Transformer, making it suitable as a foundational framework for real-time detection tasks. Thirdly, RT-DETR supports different speed and accuracy configurations by adjusting the number of decoder layers, demonstrating good adaptability for edge deployment.
[0065] However, in UAV remote sensing scenarios, the multi-scale characteristics and dense distribution of targets further amplify the impact of insufficient feature representation and alignment errors in the RT-DETR model. Simultaneously, the similarity between complex backgrounds and target textures easily leads to blurred classification boundaries and increased false detections. To suppress false detections and improve the detection accuracy of dense small targets, models typically need to introduce stronger global context modeling and more fine-grained multi-scale feature processing modules, significantly increasing computational overhead and inference latency. Therefore, there is still room for improvement in the synergistic enhancement of accuracy and efficiency.
[0066] Therefore, this embodiment discloses a target detection model for UAV remote sensing images, such as Figure 1 and Figure 2 As shown, the target detection model adopts the RT-DETR architecture.
[0067] In this embodiment, the backbone network of the RT-DETR architecture includes a convolutional stem and four stages (Stage 1, Stage 2, Stage 3, Stage 4), as follows: Figure 2 As shown. The original RT-DETR architecture's backbone network consists of three Conv Blocks and one max-pooling layer. While this design can progressively complete feature extraction and downsampling, the multiple convolutional and pooling operations increase computational complexity and memory access overhead to some extent. Furthermore, while the max-pooling layer reduces the feature map resolution, it may cause the loss of some local details, thus affecting subsequent feature modeling. In contrast, this embodiment offers a more efficient and concise convolutional stem structure, such as... Figure 3As shown, the structure consists of two consecutively stacked Conv Blocks, each containing a 3×3 convolutional layer. Both 3×3 convolutional layers have a stride of 2 to progressively downsample features. Batch normalization and SiLU activation are introduced after each 3×3 convolutional layer to enhance the network's non-linear expressiveness and stabilize the training process. Compared to the original design, the proposed convolutional stem maintains effective feature representation while removing the max-pooling layer and reducing the number of network layers. This simplified structure significantly reduces the model's computational complexity and memory consumption, and shortens the feature extraction path, thus exhibiting higher efficiency in both training and inference phases.
[0068] The backbone network of the RT-DETR architecture in this embodiment has four stages: Stage 1, Stage 2, Stage 3, and Stage 4. Stage 1 and Stage 2 are shallow stages, while Stage 3 and Stage 4 are deep stages.
[0069] In this embodiment, the UAV remote sensing images are characterized by a large scale span, dense targets, and complex backgrounds. The feature extraction capability of the backbone network directly determines the subsequent detector's ability to locate and classify small targets. However, traditional backbone networks face two challenges in the multi-scale feature extraction process: First, during continuous downsampling, the edge and texture information of small targets is gradually weakened or even lost, leading to missed detections; second, multi-scale targets coexist in remote sensing scenes, shallow features emphasize local details but lack semantic expression, while deep features have strong semantics but lack spatial details. There is a problem of multi-scale semantic inconsistency between the two, which can easily cause feature confusion and false detections in dense target scenes.
[0070] To address the aforementioned issues, this embodiment embeds CSP modules (CSPNet modules) in all four stages of the backbone network (Stage 1, Stage 2, Stage 3, and Stage 4), and embeds a single-head self-attention transform unit (PSHA Transformer Block) in one branch of the CSP module in the deeper stages, thus forming two CSP-PSHA modules, as follows. Figure 2 As shown.
[0071] In this embodiment, the CSP (Cross Stage Partial) module reduces redundant computation, improves feature reuse, and enhances training stability while maintaining the network's expressive power. The CSP module is used to divide the input features into two branches, perform feature transformation on the features of one branch, and fuse the features output from the two branches.
[0072] Specifically, let the input features be... It is divided into two branches (Part 1 and Part 2) according to the channel:
[0073] F = [F1, F2];
[0074] Where F1 represents the feature of Part 1, and F2 represents the feature of Part 2. , , The channel division ratio is used to maintain the characteristics of the direct-connect branches and allow for cross-stage flow at a lower cost, while the transformation branches are implemented through a function. () Extracts a stronger semantic representation, and the final stage output can be represented as:
[0075]
[0076] In the formula, This is for concat followed by 1×1 convolutional fusion or other fusion methods. The final fusion output of the CSP module has the following characteristics: C is the number of channels, W is the width, and H is the height.
[0077] CSP modules generally have the following characteristics and benefits:
[0078] (1) Reduce redundant calculations: Perform complex transformations only on some channels, resulting in a decrease in overall FLOPs;
[0079] (2) Enhanced gradient flow: Direct branches provide a more direct gradient propagation path, improving training stability;
[0080] (3) Promote feature reuse: retain some original detailed information and integrate it with deep semantics to improve representation efficiency.
[0081] Therefore, the CSP module is used to build lightweight backbone networks with good expressive power, and has strong engineering value in tasks such as object detection.
[0082] In this embodiment, the Single-Head Self-Attention Transformer Block (PSHA Transformer Block) is embedded in Part 2 of the CPS module in the deep stage. It applies single-head self-attention to only a subset of the input channels, leaving other channels unchanged. This method not only eliminates the computational redundancy caused by multi-head attention mechanisms but also reduces memory access costs and computational load by processing only a subset of channels. Furthermore, focusing on a subset of input channels helps the model better focus on representative channels and important features, avoiding interference from irrelevant features, thereby improving the model's learning efficiency and expressiveness.
[0083] Specifically, the single-head self-attention transformation unit includes a deep convolutional layer (DWConv) for local feature aggregation and conditional location embedding, a single-head self-attention layer (PSHA) for modeling the global context, and an enhanced convolutional gated linear unit (ECGLU) for channel interaction.
[0084] The combination of DWConv and SHSA captures local and global dependencies in a computationally and memory-efficient manner; ECGLU implements attention-focusing through channel mixer. Both deep convolutional layers and PSHA layers employ residual structures to improve training efficiency and enhance model expressiveness.
[0085] In this embodiment, PSHA can be represented in the following form:
[0086]
[0087] In the formula, W Q W K W V and W O Let Q represent the Query, Key, Value, and the output linear projection weight matrix, respectively; Q is the query vector, K is the key vector, and V is the value vector; d qk This indicates the feature dimension of the query vector and key vector (default setting is 16). Concat This indicates a feature connection operation; Split represents the Split operation, X is the input feature map, T is the transpose sign, C is the number of channels, and Cp is the number of channels. p The number of channels after partitioning. ;X res For the features of the first branch, X att This refers to the attention features of the second branch.
[0088] To achieve a consistent memory access pattern and reduce additional memory access overhead, this embodiment selects the top C features from the input feature map. p Each channel is used as a representative channel in attention calculation, thereby improving computational efficiency while ensuring information representation. It is worth noting that although attention calculation only occurs in the first C channels... p When executed on each channel, the final output projection of PSHA still applies to the entire channel dimension, not just C. pThe multiple channels allow the global interactive features generated by the attention mechanism to be effectively propagated to the other channels, enhancing the overall feature representation capability. From a structural perspective, PSHA can be viewed as unfolding and reorganizing several redundant attention heads that are computed in parallel in traditional multi-head attention along the block axis in a sequential manner, thereby reducing computational redundancy while maintaining the ability to model global dependencies.
[0089] Traditional feedforward networks (FFNs) typically consist of two fully connected layers and a nonlinear activation function. Their core function is to perform positional channel mapping of features, thereby enabling information exchange and feature remapping between channels. However, this structure mainly focuses on nonlinear transformations in the channel dimension and lacks the ability to explicitly model local spatial context. It is difficult to effectively capture local texture details and cross-regional feature interaction information, thus limiting the model's ability to represent small target edges, dense target separation, and fine-grained structures of complex backgrounds in remote sensing images.
[0090] This embodiment designs an ECGLU based on the concept of a Gated Linear Unit (GLU). Unlike traditional FFNs that use fully connected layers for feature mapping, ECGLU uses 1×1 pointwise convolutions instead of fully connected layers, significantly reducing the number of parameters and computational overhead while maintaining channel transformation capabilities. The channel interaction of the enhanced convolutional linear gated layer is as follows:
[0091] ECGLU first maps the input features using 1×1 convolutions and divides them into two branches. One branch introduces a 3×3 dilated convolution and the GELU activation function to enhance local spatial modeling capabilities at a lower cost. Then, a gating mechanism is used for element-wise modulation to achieve adaptive selection of key information. Finally, the module uses 1×1 convolutions to complete the output mapping and combines it with residual connections to obtain channel interaction features, further improving information preservation and training stability. Overall, ECGLU enhances spatial detail representation while maintaining computational efficiency, providing more discriminative feature representations for multi-scale target detection in UAV remote sensing scenarios.
[0092] Therefore, the CSP-PSHA module in this embodiment achieves a theoretical unity of complexity control and feature enhancement through the collaborative design of partial channel single-head attention and CSP cross-stage connection: on the one hand, it compresses the computational domain of attention modeling and reduces redundant feature transformations; on the other hand, it strengthens the information complementarity between shallow details and deep semantics.
[0093] In this embodiment, as Figure 1As shown, the input UAV remote sensing image is first processed by the CSP-SHAT backbone network to extract multi-scale features. The output feature layers are labeled S3, S4, and S5, corresponding to feature representations with strides of 8, 16, and 32, respectively. Considering the high resolution of UAV remote sensing images and the significant cost of introducing shallow features (e.g., the S2 feature layer incurs substantial computational and memory overhead), this embodiment uses S3–S5 as input to the subsequent EfficientHybrid Encoder to obtain a multi-scale feature set with strong semantic expressive power while ensuring real-time performance. Simultaneously, the CSP-SHAT module enhances global modeling capabilities through cross-stage feature interaction and a partial channel single-head self-attention mechanism, providing a more discriminative feature foundation for subsequent dense small target detection.
[0094] In the encoder stage, the key structure of the efficient hybrid encoder in this embodiment of RT-DETR firstly utilizes Attention-based Intra-scale Feature Interaction (AIFI) to efficiently exchange information across scales of the input features, thereby enhancing the global consistency of feature representation. Subsequently, CNN-based Cross-scale Feature Fusion (CCFF) further achieves multi-layer feature fusion and semantic enhancement, providing a more stable fused feature representation for the subsequent calibration module.
[0095] To improve the stability of dense target detection in UAV remote sensing scenarios, this embodiment embeds a dual-scale feature calibration module (DSFC module) into the CCFF module of the encoder. The dual-scale feature calibration module performs context and spatial co-calibration on the multi-layer fusion features output by the CCFF module.
[0096] Contextual information in an image refers to relevant auxiliary information in the local area surrounding the target and in the larger scene. For small targets, relying solely on the target's appearance features is often insufficient for accurate identification, especially against complex backgrounds. The surrounding area, the distribution of neighboring targets, and background information can all provide important supplementary clues for target identification. In UAV remote sensing images, small targets typically occupy a small pixel area and are often covered by complex backgrounds, making detection relying solely on local features prone to missed or false detections.
[0097] Spatial features refer to the representations in a feature map related to the target's location, boundaries, shape, and geometric layout. They not only reflect the presence of a target in an image but also characterize its location and boundaries. This is crucial for accurately detecting small targets and handling complex backgrounds. However, because features at different scales have different resolutions, strides, and receptive fields, their spatial locations may become inconsistent after upsampling, downsampling, or cross-layer fusion processing. This problem is particularly prominent in remote sensing images, especially in scenes with dense small targets, where scale differences and background interference exacerbate the spatial misalignment problem. Spatial misalignment leads to a shift in the target's response region, causing interference between neighboring targets and ultimately resulting in unstable localization.
[0098] Two typical problems exist in the dual-scale feature fusion process: First, the model faces insufficient utilization of contextual information and insufficient target saliency, especially in complex backgrounds and small target scenes, where these problems are more likely to lead to false detections. Second, features at different scales may have misalignment and unstable alignment issues in spatial location and geometric response, which makes target localization and boundary determination more difficult in dense target scenes.
[0099] This embodiment introduces a dual-scale feature calibration module to perform contextual feature calibration and spatial feature calibration. By enhancing the contextual modeling of the target's surrounding environment and calibrating spatial features, the misalignment problem caused by the fusion of features at different scales can be reduced, thereby improving the stability and accuracy of target localization.
[0100] In this embodiment, as Figure 1 As shown, the dual-scale feature calibration module includes a context feature calibration (CFC) submodule and a spatial feature calibration (SFC) submodule. The CFC module includes three fusion nodes (i.e., three fusions). The context feature calibration submodule is connected to the third fusion node, and the spatial feature calibration submodule is connected to the first fusion node and the context feature calibration submodule, respectively.
[0101] The context feature calibration submodule is used to: aggregate the high-level feature map output by the third fusion node through pyramid pooling to enhance the semantic consistency and saliency of the high-level feature map based on the attention mechanism; the spatial feature calibration submodule is used to: perform dynamic spatial correction on the input feature map based on the deformable alignment strategy, and the feature map input to the spatial feature calibration submodule is: the context-corrected feature map output by the context feature calibration submodule and the low-level feature map output by the first fusion node.
[0102] Specifically, the context feature calibration submodule includes: a multi-scale context extraction layer, a dynamic attention fusion layer, and a local spatial refinement layer.
[0103] The multi-scale context extraction layer is used to perform adaptive average pooling operations on high-level feature maps at different scales based on the improved Parallel Pyramid Pooling Module (PPPModule) to obtain pooled features at different scales; the pooled features at different scales are then concatenated along the spatial dimension to form a multi-scale context descriptor.
[0104] Specifically, for a given input feature map F1 (high-level feature map), PPPModule uses a hierarchical pooling strategy to perform pooling at different scales g. k The following adaptive average pooling operation is performed:
[0105]
[0106] in, This indicates a preset sequence of grid sizes.
[0107] Subsequently, the pooling features obtained at different scales are concatenated along the spatial dimension to form a multi-scale context descriptor C. Ctx :
[0108]
[0109] This multi-scale context descriptor effectively encodes global semantic information across multiple scales while maintaining consistency across feature channels.
[0110] The dynamic attention fusion layer is used to perform adaptive fusion of multi-scale context descriptors based on a cross-attention mechanism to obtain preliminary fused features. Specifically, it is shown in the following equation:
[0111] Q1 = Conv1D(SiLU(Wq F1))
[0112] K1, V1 = PPP-Projection(F1)
[0113] In the formula, Q1 is the query vector of the cross-attention mechanism, K1 and V1 are the key and value extracted from PPPModule, and PPP represents the multi-scale context descriptor C. Ctx .
[0114] The local spatial refinement layer is used to enhance the preliminary fused features based on the local attention mechanism to obtain the enhanced fused features. The enhanced fused features are then connected to the high-level feature map through residuals to obtain the context-corrected feature map.
[0115] The local attention mechanism in this example is as follows: First, a 1 × 1 convolution is used to reduce the channel dimension while preserving spatial relationships; then, a 3 × 3 depthwise convolution is applied to establish the local receptive field. The generated spatial attention weights undergo a non-linear transformation using the Tanh activation function, as shown in the following formula:
[0116] M att = tanh(C 33 (σ(C 11 (F2))))
[0117] In the formula, M att C represents the local attention coefficient. 33 For a 3×3 convolution, C 11 The function is a 1×1 convolution, F2 is the initial fusion feature, and σ is the SiLU activation function. Then, the local attention coefficients are weighted and fused with the initial fusion feature to obtain the enhanced fusion feature.
[0118] In this embodiment, the deformable alignment strategy is as follows: The context-corrected feature map is convolutionally compressed and then bilinearly upsampled and scaled to the same resolution as the low-level features to obtain processed high-level features; the low-level feature map is convolutionally enhanced to obtain enhanced low-level features; the processed high-level features and the enhanced low-level features are concatenated and fused along the channel dimension to obtain a fused feature map; the fused feature map is input into a cascaded convolutional network to predict low-level offsets, high-level offsets, and attention coefficients; based on a grouped deformable convolution mechanism, the processed high-level features and the enhanced low-level features are divided into G decoupled subspaces, and grid coordinate normalization is performed on each decoupled subspace to generate a basic sampling grid; the low-level offsets and high-level offsets are superimposed on the basic grid to obtain deformable sampling points, and bilinear interpolation correction is performed on the deformable sampling points to obtain corrected high-level features and low-level features; attention fusion weights are generated based on the attention coefficients, and weighted fusion is performed on the corrected high-level features and low-level features based on the attention fusion weights to obtain spatially calibrated fused features.
[0119] In this embodiment, the context-corrected feature map is used as the high-level feature map. A 3×3 convolution is used to compress the channels, and bilinear upsampling is used to scale it to the same resolution as the low-level features. The low-level feature map is enhanced with a 3×3 convolution to enhance local detail texture and retain the contour information of small targets.
[0120] Therefore, the spatial feature calibration module uses a dual-branch convolutional structure to process the input features at multiple scales. High-level semantic features are compressed through a 3 × 3 convolutional layer and spatially upsampled using bilinear interpolation to restore the resolution of low-level features. Simultaneously, low-level features are enhanced through a 3 × 3 convolutional layer to preserve their spatial details. This process can be described as follows:
[0121] F sp = Bilinear(Conv32(sp)), F cp = Conv8(cp) .
[0122] In the formula, F sp For the processed high-level features, F cp This refers to the enhanced low-level features.
[0123] Next, a cascaded convolutional network is constructed to generate spatial transformation parameters: concatenated features are extracted through depthwise separable convolutional layers, and then dynamic offsets are predicted using a 4 × G + 2 channel convolutional layer. This process can be summarized as follows:
[0124]
[0125] In the formula, This is a dynamic offset. This is the low-level offset. This is the high-level offset. G represents the attention coefficient; G is the number of groups; the first 4 × G channels correspond to and , representing the x / y axis offsets of low-level and high-level features, respectively. The last two channels... The weights are used for calculating attention fusion. The offset convolutional layers are initialized using a Xavier normal distribution, and the weights of the offset convolutional layers are initialized with a zero-centered distribution.
[0126] A grouped deformable convolution mechanism is introduced to divide the features into G decoupled subspaces. A normalized grid coordinate system is used to generate a basic sampling grid, and the predicted dynamic offsets are superimposed on the basic grid to construct deformable sampling points. Bilinear interpolation is then used to resample the feature map. The mathematical expression for this process is as follows:
[0127]
[0128] In the formula, Indicates the sampling neighborhood. Let represent the bilinear interpolation kernel, p represent the discrete grid points in the sampling neighborhood that participate in the bilinear interpolation, q represent the target sampling position in the output feature map, and Δl(q) and Δh(q) represent the sampling offsets of the low-level and high-level features at position q, respectively. These are the corrected low-level features. These are the corrected high-level features.
[0129] In this embodiment, the attention coefficients are generated by using a restricted activation function (Tanh) to generate attention fusion weights, and the attention fusion weights range from [0, 2].
[0130] The core task of the context feature calibration submodule in this embodiment is to enhance contextual information to improve target saliency, especially in complex backgrounds and small target scenes. Through multi-scale pooling, the context feature calibration submodule extracts contextual information from multiple scales and fuses it using an attention mechanism to enhance target discriminability and reduce background interference. This module helps improve the detectability of small targets and ensures the stability of detection results. The core function of the spatial feature calibration submodule is to spatially align features at different scales, solving the problem of spatial misalignment between features at different scales. Through deformable convolution, the spatial feature calibration submodule learns the offset of features and aligns them, ensuring spatial consistency of features at different scales, thereby improving the accuracy of target localization. The spatial feature calibration submodule performs geometric alignment of features by learning spatial offsets, thereby reducing spatial inconsistencies that occur during cross-scale fusion. This operation helps improve the localization accuracy of targets in dense small target scenes, especially for targets in complex backgrounds, enabling more accurate determination of target positions. The context feature calibration submodule and the spatial feature calibration submodule form a complementary mechanism through cascading. The contextual feature calibration submodule provides semantically enhanced contextual information to the spatial feature calibration submodule, while the spatial feature calibration submodule enhances the accuracy of target localization by aligning the feature space. Combined, these two submodules enable the model to detect targets more stably and improve localization accuracy in dense, small-target scenarios.
[0131] In this embodiment, during the detection phase, the original RT-DETR encoder and detection head structure remain unchanged. A fixed number of target queries are output using ensemble prediction to complete target category prediction and bounding box regression, inheriting the end-to-end detection paradigm that does not require NMS. Keeping the decoder and detection head unchanged not only helps control complexity and ensure real-time performance, but also makes it easier to demonstrate the independent contribution of the improved module in this paper to the performance improvement.
[0132] As a further optimization of this embodiment, at the training objective function level, this embodiment replaces the original loss function with a Focaler-MPDIoU loss function jointly constructed by MPDIoU and Focaler-IoU, to adapt to the characteristics of high false positive sample ratio and unstable regression of dense small targets in UAV remote sensing scenarios. MPDIoU is used to improve the geometric matching quality and localization accuracy of bounding box regression, while the Focaler mechanism is used to dynamically focus on difficult and high-quality samples and enhance the ability to suppress high IoU false positive samples, thereby alleviating the problem of false detection accumulation caused by complex backgrounds.
[0133] In this embodiment, MPDIoU is a bounding box similarity comparison metric based on the minimum point distance. By establishing an L2 norm calculation system for the corner coordinates of the prediction box and the ground truth box, it realizes comprehensive consideration of key geometric parameters such as the overlapping area, the Euclidean distance between the center points, and the width and height deviation. Compared with traditional methods, MPDIoU not only maintains the completeness of the bounding box metric, but also significantly simplifies the calculation process through algebraic operations of coordinate parameters. The calculation of MPDIoU as the bounding box loss is summarized as follows:
[0134]
[0135]
[0136] In the formula, A denotes the predicted bounding box, and B denotes the ground truth bounding box; d1 denotes the Euclidean distance between the corresponding top-left corner points of the predicted bounding box and the ground truth bounding box, and d2 denotes the Euclidean distance between the corresponding bottom-right corner points of the two; w and h respectively denote the width and height of the input image; MPDIoU denotes the Minimum Point Distance Intersection over Union; L MPDIoU denotes the corresponding MPDIoU bounding box regression loss;
[0137] Aiming at the problem of category imbalance of training samples, Focaler-loss pays attention to different regression samples through linear interval mapping, so as to improve the performance of the detector. The formula is as follows:
[0138]
[0139] wherein, IoU focaler denotes the reconstructed Intersection over Union obtained by performing piecewise linear interval mapping on the original Intersection over Union, and IoU denotes the original Intersection over Union between the predicted bounding box and the ground truth bounding box; v denotes the lower threshold of the Focaler-IoU interval mapping, u denotes the upper threshold of the Focaler-IoU interval mapping, and 0≤v<u≤1. By adjusting the values of v and u, the piecewise linear mapping interval can be changed, so that the loss function focuses on the bounding box regression samples in different IoU intervals. The corresponding Focaler-IoU loss is defined as follows:
[0140]
[0141] Finally, combining MPDIoU and Focaler-IoU, the Focaler-MPDIoU loss function of this embodiment is constructed, and the formula of Focaler-MPDIoU is as follows:
[0142]
[0143] By leveraging the geometric constraints of IoU and the hard example weighting mechanism of Focaler, the accuracy and training stability of object detection are improved. The final loss is defined as follows:
[0144]
[0145] This embodiment's Focaler-MPDIoU loss function combines the geometric constraints of IoU with the dynamic weighting mechanism of Focaler-loss, aiming to address regression instability and hard-example focusing issues in dense, small-object scenes. Specifically, MPDIoU enhances regression accuracy by optimizing the bounding box geometry, while Focaler-loss strengthens its focus on hard samples through weighted adjustments, making the regression process more stable. This is particularly effective in improving detection performance in complex backgrounds and with small objects.
[0146] Example 2
[0147] To verify the effectiveness and generalization ability of the UAV remote sensing image target detection model in Example 1, this chapter conducts experimental evaluations on the visible light UAV target detection datasets VisDrone and UAVDT, as well as the high-altitude infrared thermal imaging dataset HIT-UAV, and uses a unified evaluation index to quantitatively analyze the detection performance.
[0148] (1) VisDrone-2019 dataset
[0149] The VisDrone-2019 benchmark, developed by the AISKYEYE research group at the Machine Learning and Data Mining Laboratory of Tianjin University, constructs a multimodal aerial perception database. This dataset contains 288 time-stamped video sequences, 261,908 sampled images, and 10,209 high-resolution still images, all acquired by an imaging platform mounted on a UAV. The dataset captures systematic variations across four key dimensions, covering a wide range of scenarios: 1) geographic distribution (including 14 Chinese cities, spanning 3000 kilometers); 2) environmental context (various scenarios from urban centers to rural landscapes); 3) target categories (including pedestrians, cyclists, and various types of vehicles); and 4) crowd density (from isolated targets to dense clusters). Of particular note is that over 50% of the targets have a pixel area smaller than 1024 pixels (i.e., 32×32), making them suitable for the challenging criteria of small target detection tasks. Furthermore, the VisDrone-2019 dataset demonstrates significant diversity in target category distribution and object size distribution.
[0150] To ensure rigorous performance evaluation, a three-way split was used for the dataset. The training subset, containing 6471 images, was used for parameter optimization and feature representation development. A separate validation set, comprising 548 images, was used primarily to monitor the effects of regularization, hyperparameter tuning, and to prevent overfitting. The final evaluation used a test set of 1610 images, which were specifically reserved to quantify the model's generalization ability and operational effectiveness on new data.
[0151] (2) UAVDT dataset
[0152] The UAVDT dataset is a large-scale benchmark dataset for drone visual perception, jointly built by the Chinese University of Hong Kong and SenseTime. This dataset uses high-definition cameras mounted on drones to collect a total of 80,000 consecutive video frames in diverse urban scenes, including main urban roads, highways, and complex building areas. It covers various lighting conditions and weather variations, effectively simulating the visual challenges of real-world drone operations. The dataset includes three categories of object annotations: cars, trucks, and buses.
[0153] Because significant temporal redundancy exists between adjacent frames in the original video sequence (e.g., target displacement less than 5 pixels), a non-redundant sparse dataset was constructed by extracting one frame every 20 frames at a fixed interval. Ultimately, this sparse dataset contains 1414 training samples, 404 validation samples, and 202 test samples, divided in a 7:2:1 ratio. This partitioning scheme adheres to the video-level independence principle (i.e., all frames of the same video belong to only one subset), and stratified sampling ensures statistical consistency among the training, validation, and test sets in terms of target category distribution and environmental complexity.
[0154] (3) HIT-UAV dataset
[0155] The HIT-UAV dataset is a high-altitude infrared thermal dataset for drone target detection applications. This dataset comprises 2898 infrared thermal images extracted from 43470 frames in hundreds of videos captured by drones in various scenes, such as schools, parking lots, roads, and playgrounds. The dataset contains five categories of dense and small objects, including people, vehicles, and bicycles. The HIT-UAV dataset aims to address the challenges of applying drones in dark environments, such as nighttime urban traffic monitoring. To meet experimental requirements, the dataset is divided into three parts: 2008 images are allocated as the training dataset, 287 as the validation dataset, and 571 as the test dataset.
[0156] All experiments were conducted under the same hardware and software environment. The network was implemented using PyTorch on a Windows 10 operating system, equipped with an Nvidia RTX A6000 GPU and CUDA 11.8. AdamW was used as the optimizer, and the input image size was 640×640 pixels. The network training epochs were set to 300, the early stopping epochs to 20, and the batch size to 8. The initial learning rate was set to 0.0001. The momentum parameter and weight decay were set to 0.9 and 0.0001, respectively.
[0157] To evaluate the model's accuracy, the PASCAL VOC evaluation method was used. Key metrics included: Average Precision (AP), mean Average Precision (mAP), Precision (P), and Recall (R). A precision-recall (PR) curve was plotted using recall and precision, with the area under the curve representing average precision. mAP was defined as the average AP across all target classes.
[0158] In addition to considering the accuracy of the model, its computational cost must also be given equal importance. To determine the number of learnable parameters in the model, millions of parameters (M Params) are used, while billions of floating-point operations (GFLOPs) are used to calculate the total number of multiplication and addition operations performed during the model inference process, which represents the computational cost.
[0159] The model validity analysis of this embodiment is as follows:
[0160] This embodiment builds a baseline framework based on the RT-DETR-R18 model and conducts systematic ablation experiments on the VisDrone-2019 dataset to verify the effectiveness of the three core components: the CSP-SHAT backbone network, the DSFC module, and the Focaler-MPDIoU loss function. While focusing on model accuracy metrics, this study also highlights the importance of key efficiency metrics.
[0161] The ablation experiment results are shown in Table 1. When ResNet-18 (Model 2) was replaced with the proposed CSP-SHAT backbone network, the test set mAP50 and mAP50:95 were significantly improved by 2.0% and 1.4%, respectively, while the number of model parameters decreased by 31.8% and the computational complexity decreased by 12.3%. The results show that the backbone network not only enhances the multi-scale feature representation capability through the cross-stage single-head self-attention module, but also reduces memory access costs and computational overhead by leveraging a partial channel processing mechanism. After introducing the DSFC module in Model 3, mAP50 and mAP50:95 were further improved by 1.0% and 0.6%, respectively. Although it introduces a slight computational overhead, its global-local feature co-optimization strategy and deformable alignment mechanism can dynamically calibrate context and spatial features, verifying the effectiveness of the proposed multi-scale recalibration module. Model 4 replaces the traditional GIoU loss function with the proposed Focaler-MPDIoU loss function. While maintaining the stability of the bounding box regression metrics, mAP50 and mAP50:95 are improved by 0.4% and 0.2%, respectively, demonstrating that its linear interval mapping mechanism can selectively focus on key regression samples, especially improving the detection performance of difficult targets. Notably, the joint optimization of CSP-SHAT and DSFC in Model 5 produces a synergistic enhancement effect, with mAP50 and mAP50:95 improving by 2.5% and 1.8% compared to the baseline, respectively, demonstrating the complementary effect between hierarchical feature extraction and dynamic feature calibration mechanisms.
[0162] When the three improved modules are integrated, the CDF-DETR framework (Model 6) achieves a significant and balanced performance improvement: the test sets mAP50 and mAP50:95 are improved by 3.1% and 2.1% respectively, the number of parameters is reduced by 25.7%, and the computational FLOPs increase by only 2.6%.
[0163] Table 1 Ablation experimental results on the VisDrone-2019 dataset
[0164]
[0165] annotation: The symbol indicates the structure for adding the corresponding column.
[0166] like Figure 4As shown, the mAP curves of each ablation model during training with Epoch are further illustrated. The mAP values of all models converged rapidly after a rapid increase, without oscillations, indicating the stability of the training process. It can be observed that all models experienced rapid mAP increases in the early stages of training, then gradually stabilized and converged, with no significant oscillations throughout the training process, indicating a relatively stable model optimization process. Compared to the baseline model, models incorporating CSP-SHAT, DSFC, or Focaler-MPDIoU all achieved varying degrees of improvement in final convergence accuracy, validating the effectiveness of each improved module. Furthermore, the complete CDF-DETR model achieved the highest mAP50-95 and mAP50 values in the later stages of training, demonstrating the most significant performance advantage.
[0167] Ablation experiments demonstrate that the multi-module collaborative improvement method proposed in Example 1 significantly improves detection accuracy while maintaining training stability, particularly excelling in handling dense small targets and complex backgrounds. Experiments validate the effectiveness of the CSP-SHAT backbone network, DSFC module, and Focaler-MPDIoU loss function; their combination enhances feature representation, utilization of contextual information, and localization accuracy. Overall, these improvements not only enhance the model's detection performance but also adapt to the practical needs of UAV remote sensing image target detection tasks, achieving a good balance between accuracy and computational complexity. Therefore, this method has strong practical application potential, especially under the requirement of efficient and accurate target detection.
[0168] Example 3
[0169] The UAV remote sensing image target detection model in Example 1 significantly improves detection performance while achieving superior complexity characteristics compared to the baseline model, namely a significant reduction in the number of parameters and only a slight change in FLOPs. However, due to the encoder-decoder structure and ensemble prediction mechanism, DETR-type detectors still incur certain structural costs in terms of computational graph structure and operator overhead. This makes it difficult for the model, even after architectural improvements, to directly meet real-time and power consumption constraints on resource-constrained UAV embedded platforms. Therefore, for the UAV remote sensing image target detection model in Example 1, further compressing the model size, reducing computational load, and improving inference speed for edge deployment remains necessary and has engineering value.
[0170] Specifically, this embodiment provides a lightweight deployment method for target detection models applied to UAV remote sensing images, such as... Figure 5 As shown, the method includes:
[0171] Step S1: Prune the target detection model based on the preset pruning algorithm to obtain the pruned model.
[0172] This embodiment preferably uses structured pruning for model compression. Compared to unstructured pruning, structured pruning has significant advantages in terms of pruning granularity and actual deployment benefits. Unstructured pruning uses a single weight parameter as the smallest pruning unit, reducing model redundancy by setting weights with small amplitudes to zero. Theoretically, it can achieve a high parameter sparsity rate while maintaining accuracy without changing the network topology. However, the sparse matrix it generates is difficult to translate into actual inference speed improvement under a general inference framework; it can only reduce storage consumption but cannot significantly reduce FLOPs and inference latency.
[0173] The steps of structured pruning in this embodiment are as follows:
[0174] (1) Importance assessment and structural unit ranking: Based on different pruning criteria, each structural unit of the network is assigned an importance score and ranked to identify the unit that contributes the most to the model performance, providing a basis for subsequent pruning.
[0175] (2) Perform structured pruning and model reconstruction according to the target compression ratio: Prune the corresponding structural units under the given target compression ratio, while maintaining the consistency of the network structure, to ensure that the pruned network can perform inference effectively and minimize performance loss.
[0176] (3) Unified fine-tuning: Fine-tuning is performed on the pruned network using a unified training configuration to recover as much as possible the model accuracy loss caused by pruning.
[0177] (4) Performance evaluation and iterative iteration: After fine-tuning, evaluate the model performance and compare the detection accuracy and inference efficiency before and after pruning. Select the optimal pruning configuration through a pruning-fine-tuning-evaluation cycle.
[0178] The preset pruning algorithm in this embodiment can be any one of Random pruning, L1 Norm pruning, Group Norm pruning, LAMP pruning, and Group Taylor pruning. This embodiment preferably uses LAMP pruning. Figure 6 The figure shows the variation in accuracy and complexity of LAMP pruning under different compression ratios. From... Figure 6 As can be seen, with the increase of compression ratio, model complexity continuously decreases, but detection accuracy decreases simultaneously; the area around Speed-up=2.0 corresponds to a key turning point in the trade-off between accuracy and complexity. Based on this, this embodiment ultimately selects the pruned model obtained by LAMP pruning at Speed-up=2.0 as the student model for subsequent distillation recovery experiments.
[0179] Step S2: During the training phase, the object detection model is used as the teacher model and the pruning model is used as the student model. The pruning model is distilled based on the multi-decoder prediction logic distillation strategy, and the distillation process is supervised based on the weighted mechanism of the teacher prediction confidence of the teacher model to obtain the distilled lightweight model.
[0180] While the structured pruning in this embodiment effectively reduces the computational complexity and parameter size of the model, it also adversely affects the multi-decoder layer-by-layer prediction mechanism, the encoder-decoder collaborative relationship, and the overall prediction stability. This indicates that for RT-DETR-type detection models, relying solely on structured pruning is insufficient to simultaneously achieve model lightweighting and detection performance maintenance. Therefore, it is necessary to introduce a recovery mechanism to address the degradation of prediction logic after pruning.
[0181] Therefore, during the training phase, the input image is simultaneously fed into both the teacher and student models. The Encoder output is considered the initial prediction state for the decoding phase, denoted as the prediction result at stage 0. Subsequent Decoder outputs constitute a coarse-to-fine layer-by-layer prediction process. During distillation, the teacher and student models generate classification scores and bounding box results at their respective prediction stages. A consistency constraint is applied to the multi-stage prediction logic through layer-by-layer alignment to guide the pruned student model to revert to the same layer-by-layer inference behavior as the teacher model. This distillation constraint is introduced only during the training phase and does not add additional computational overhead during the inference phase, making it suitable for embedded deployment scenarios.
[0182] Specifically, the multi-decoder prediction logic distillation strategy is as follows: the teacher model and the student model generate classification scores and bounding boxes respectively in their corresponding prediction stages; based on the weighting mechanism of teacher prediction confidence, the teacher confidence weight is calculated layer by layer; based on the teacher confidence weight, three types of single-stage distillation losses are constructed hierarchically: boundary L1 distillation loss, GIoU distillation loss, and classification BCE distillation loss; hierarchical weighted fusion is performed on the three types of single-stage distillation losses to obtain the multi-decoder global distillation loss; the original detection loss of the teacher model is obtained, and the total loss of the student model is determined based on the multi-decoder global distillation loss and the original detection loss; based on the total loss of the student model, backpropagation is used to update all parameters of the student model to obtain the distilled lightweight model.
[0183] As a further optimization of this embodiment, considering that the student model's prediction stability decreases after pruning, and that different prediction results have different importance to the distillation process, this embodiment further introduces a weighting mechanism based on the teacher's prediction confidence. Specifically, the teacher model's classification output in the l-th prediction stage is extracted; a target confidence is generated based on the classification output in the l-th prediction stage; and teacher confidence weights are generated based on the target confidence.
[0184] Let S be the classification output of the teacher model in the l-th prediction stage. l t The corresponding target confidence level is defined as:
[0185]
[0186] In the formula, Let σ(·) represent the target confidence level for the l-th prediction stage. Teacher confidence is used to measure the importance of different prediction outcomes and serves as the weighting basis for the bounding box distillation term. To further suppress the uncertainty interference caused by low-confidence predictions, the teacher confidence weight is adjusted. Introducing piecewise power function transformation:
[0187]
[0188] In the formula, γ is a control parameter. By controlling the parameter, the influence of low-confidence prediction in the distillation process can be reduced, while the supervisory role of high-confidence prediction can be enhanced, thereby improving the stability and effectiveness of the distillation process.
[0189] Furthermore, considering the differences in contribution of the Encoder output and the outputs of different Decoder layers to the final detection result, this paper further applies hierarchical weighting to the distillation loss at different prediction stages. Specifically, relatively weak constraints are applied to the initial prediction stage and shallow Decoders, while stronger distillation weights are applied to the outputs of deep Decoders to highlight the guiding role of high-quality prediction results in the later stages for student model recovery. Through this combination of multi-stage prediction logic alignment and confidence weighting, the proposed method can effectively constrain the multi-layer inference behavior of the pruned model without introducing additional model structure, laying the foundation for subsequent distillation loss function design and performance recovery experiments.
[0190] Based on the multi-decoder prediction logic consistency distillation framework and confidence weighting mechanism, this embodiment further constructs a prediction logic distillation loss function for object detection tasks and provides corresponding training settings.
[0191] Let the outputs of the teacher model and the student model in the l-th prediction stage be represented as follows:
[0192]
[0193] In the formula, The output of the teacher model in the l-th prediction stage. The output of the student model in the l-th prediction stage. This indicates the bounding box prediction result. This represents the classification prediction logits. In this embodiment, the Encoder output is regarded as the prediction result of stage 0, and the Decoder output of each subsequent layer is regarded as the prediction result of layer-by-layer refinement. Consistency constraints are applied to the classification output and bounding box output of the teacher model and the student model at each corresponding stage.
[0194] Regarding bounding box distillation, this embodiment uses L1 loss to constrain the difference between the predicted boxes of the student model and the teacher model (i.e., boundary L1 distillation loss), which is defined as:
[0195]
[0196] In the formula, For the boundary L1 distillation loss in the l-th prediction stage, Weighting of teacher confidence scores. This indicates element-wise weighting.
[0197] To further enhance the student model's constraint on the target space structure, this paper also introduces a GIoU-based bounding box consistency distillation loss (i.e., GIoU distillation loss):
[0198]
[0199] In the formula, Let GioU be the distillation loss in the l-th prediction stage.
[0200] At the classification prediction level, a distillation constraint based on binary cross-entropy is adopted, and its loss function is defined as:
[0201]
[0202] In the formula, The BCE distillation loss is used for classification in the l-th prediction stage. This means that the teacher model's classification output, after being mapped by a Sigmoid algorithm, is used as a soft label to supervise the student model's classification results.
[0203] Considering that different prediction stages contribute differently to the final detection result, this paper further applies hierarchical weights to the distillation loss at each stage. Let the hierarchical weight of the l-th prediction stage be α. l The overall predictive logistic distillation loss can then be written as:
[0204]
[0205] In the formula, L represents the total number of prediction stages. For the overall prediction of logistic distillation loss, λ1, λ2, and λ3 represent the balance coefficients of the three types of single-stage distillation losses, respectively. This embodiment uses fixed hierarchical weights for different prediction stages to highlight the guiding role of high-quality prediction results in the later stages for the recovery of the student model.
[0206] During the training phase, the teacher model parameters remain frozen, and only the pruned student model parameters are updated. The overall optimization objective of the student model is defined as:
[0207]
[0208] In the formula, To reduce the overall weight of distillation loss, The original detection loss for the student model is the Focaler-MPDIoU loss.
[0209] Furthermore, considering that distillation constraints are primarily used to guide the student model to recover the prediction logic of the teacher model, this paper does not apply distillation supervision throughout the entire training cycle. Instead, distillation loss is enabled in the early and middle stages of training, and its intensity is gradually reduced using a distillation loss decay strategy. This allows the student model to rely more on the original detection target to achieve parameter convergence in the later stages of training. It should be noted that prediction logic distillation is only introduced during the training phase and does not add additional computational overhead during the inference phase. Therefore, it is suitable for embedded deployment scenarios with high requirements for computational resources and real-time performance.
[0210] Therefore, in this embodiment, when deploying the target detection model, the target detection model is first pruned, and then the pruned model is distilled using a multi-decoder prediction logic distillation strategy. The distillation process is supervised based on a weighted mechanism of teacher prediction confidence of the teacher model. This allows the lightweight model after distillation to retain most of the detection performance with extremely low storage and computational overhead, which is superior to traditional solutions such as feature distillation and single-layer distillation. It can provide a lightweight, high-precision, and feasible edge detection solution for UAV intelligent perception tasks such as traffic inspection, disaster early warning, and low-altitude security.
[0211] This embodiment also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the deployment method in Embodiment 3.
[0212] This embodiment also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the deployment method in Embodiment 3.
[0213] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0214] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A system that specifies functions in one or more boxes.
[0215] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A target detection model for UAV remote sensing images, wherein the target detection model adopts an RT-DETR architecture, the RT-DETR architecture comprising a backbone network and an encoder connected in sequence, characterized in that, Both the shallow and deep stages of the backbone network embed CSP modules. The CSP modules are used to divide the input features into two branches, perform feature transformation on the features of one branch, and perform fusion on the features output from the two branches. In one branch of the CSP module in the deep stage, a single-head self-attention transformation unit is embedded. The single-head self-attention transformation unit includes a deep convolutional layer for local feature aggregation and conditional location embedding, a single-head self-attention layer for modeling the global context, and an enhanced convolutional linear gated layer for channel interaction. The encoder's CCFF module embeds a dual-scale feature calibration module, which performs context and spatial co-calibration on the multi-layer fusion features output by the CCFF module.
2. The UAV remote sensing image target detection model according to claim 1, characterized in that, The backbone network of the RT-DETR architecture uses two consecutively stacked 3×3 convolutional layers as its convolutional stem, with a stride of 2 for both layers.
3. The UAV remote sensing image target detection model according to claim 1, characterized in that, The dual-scale feature calibration module includes a context feature calibration submodule and a spatial feature calibration submodule. The CCFF module includes three fusion nodes. The context feature calibration submodule is connected to the third fusion node, and the spatial feature calibration submodule is connected to the first fusion node and the context feature calibration submodule, respectively. The context feature calibration submodule is used to: aggregate the high-level feature map output by the third fusion node through pyramid pooling to enhance the semantic consistency and saliency of the high-level feature map based on the attention mechanism, thereby improving the cross-scale context information. The spatial feature calibration submodule is used to perform dynamic spatial correction on the input feature map based on a deformable alignment strategy. The feature map input to the spatial feature calibration submodule is the context-corrected feature map output by the context feature calibration submodule and the low-level feature map output by the first fusion node.
4. The UAV remote sensing image target detection model according to claim 3, characterized in that, The context feature calibration submodule includes: The multi-scale context extraction layer is used to perform adaptive average pooling operations on high-level feature maps at different scales based on the improved parallel pyramid pooling module to obtain pooled features at different scales; the pooled features at different scales are concatenated along the spatial dimension to form a multi-scale context descriptor. The dynamic attention fusion layer is used to perform adaptive fusion of multi-scale context descriptors based on the cross-attention mechanism to obtain preliminary fused features. The local spatial refinement layer is used to enhance the preliminary fused features based on the local attention mechanism to obtain enhanced fused features. The enhanced fused features are then connected to the high-level feature map through residual concatenation to obtain the context-corrected feature map.
5. The UAV remote sensing image target detection model according to claim 3, characterized in that, The deformable alignment strategy is as follows: The context-corrected feature map is convolutionally compressed and then bilinearly upsampled and scaled to the same resolution as the low-level features to obtain the processed high-level features. Convolutional enhancement is performed on the low-level feature map to obtain the enhanced low-level features; The processed high-level features and the enhanced low-level features are spliced and fused along the channel dimension to obtain a fused feature map; The fused feature map is input into a cascaded convolutional network to predict low-level offsets, high-level offsets, and attention coefficients. Based on the grouped deformable convolution mechanism, the processed high-level features and the enhanced low-level features are divided into G decoupled subspaces. The grid coordinate normalization process is performed on each decoupled subspace to generate the basic sampling grid. The low-level offset and high-level offset are superimposed on the base mesh to obtain deformed sampling points, and bilinear interpolation correction is performed on the deformed sampling points to obtain the corrected high-level features and low-level features. Based on the attention coefficient, attention fusion weights are generated. Weighted fusion is then performed on the corrected high-level features and low-level features based on the attention fusion weights to obtain spatially calibrated fused features.
6. The UAV remote sensing image target detection model according to any one of claims 1-5, characterized in that, The loss function of the target detection model is the Focaler-MPDIoU loss function, which is jointly constructed from MPDIoU and Focaler-IoU.
7. The UAV remote sensing image target detection model according to claim 6, characterized in that, The channel interaction of the enhanced convolutional linear gated layer is as follows: The features input to the enhanced convolutional linear gated layer are mapped and divided into two branches through a 1×1 convolution, resulting in two branch features; One of the branch features is processed by a 3×3 dilated convolution and a nonlinear transformation of the GELU activation function to obtain the branch output feature; Based on the gating mechanism, the branch output features are modulated element-wise with another branch to obtain the branch fusion features; The branch fusion features are mapped to the output through a 1×1 convolution to obtain the channel interaction features.
8. A lightweight deployment method for a target detection model in UAV remote sensing images according to any one of claims 1-7, characterized in that, The method includes: The target detection model is pruned based on a preset pruning algorithm to obtain a pruned model. During the training phase, the object detection model is used as the teacher model and the pruning model is used as the student model. The pruning model is distilled based on the multi-decoder prediction logic distillation strategy, and the distillation process is supervised based on the weighting mechanism of the teacher prediction confidence of the teacher model, resulting in a lightweight model after distillation.
9. The lightweight deployment method according to claim 8, characterized in that, The multi-decoder prediction logic distillation strategy is as follows: The teacher model and the student model generate classification scores and bounding boxes respectively in the corresponding prediction stage; Based on the weighting mechanism of teachers' prediction confidence, the weight of teachers' confidence is calculated layer by layer; Based on teacher confidence weights, three types of single-stage distillation loss are constructed hierarchically: boundary L1 distillation loss, GIoU distillation loss, and classification BCE distillation loss. Hierarchical weighted fusion is performed on the three types of single-stage distillation losses to obtain the global distillation loss of the multi-decoder; Obtain the raw detection loss of the teacher model, and determine the total loss of the student model based on the global distillation loss of the multi-decoder and the raw detection loss; Based on the total loss of the student model, backpropagation is used to update all parameters of the student model to obtain the distilled lightweight model.
10. The lightweight deployment method according to claim 9, characterized in that, The weighting mechanism for the teacher's prediction confidence is as follows: Extract the classification output of the teacher model in the l-th prediction stage; Generate the target confidence score based on the classification output of the l-th prediction stage; Teacher confidence weights are generated based on the target confidence level.