A lightweight unmanned aerial vehicle small target detection method and system based on directional context coding and double-path feature aggregation
Patent Information
- Application Number
- CN202611192210.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-07
- Publication Date
- 2026-10-27
AI Technical Summary
1)本发明通过LDC局部方向上下文编码模块,在不降低特征图空间分辨率的前提下对中心、右侧、下侧和右下方向的局部偏移信息进行编码,使网络能够更充分地保留小目标的弱边缘、纹理、轮廓和局部连续性信息,缓解小目标在卷积和下采样过程中被弱化或抹除的问题。
Smart Images

Figure CN122990538A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of target detection technology, and in particular to a lightweight method and system for detecting small targets on unmanned aerial vehicles (UAVs) based on orientation context encoding and dual-path feature aggregation. Background Technology
[0002] Existing object detection technologies have been widely applied in the field of computer vision. Mainstream technologies include two-stage detectors such as Faster R-CNN, Mask R-CNN, and Cascade R-CNN; one-stage detectors such as the YOLO series; and Transformer detection frameworks such as DETR and Swin Transformer. These methods can achieve object localization and category recognition in typical natural scenes and have formed relatively mature backbone networks, feature pyramids, and detection head designs.
[0003] In drone aerial imagery scenarios, due to the influence of shooting altitude, top-down perspective, and imaging distance, the targets to be detected typically exhibit characteristics such as small scale, dense distribution, large pose variations, frequent occlusion, and complex backgrounds. For these scenarios, existing technologies generally improve detection performance through multi-scale feature fusion, attention mechanisms, high-resolution feature preservation, lightweight backbone networks, or improvements to the YOLO structure. For example, FPN-like structures enhance cross-scale expressive capabilities through top-down feature fusion; attention modules such as SE and CBAM enhance salient feature responses through channel or spatial recalibration; and some drone target detection methods enhance small target detection capabilities by adding shallow prediction branches, improving the Neck structure, or introducing lightweight convolutional modules.
[0004] However, most existing methods only improve in one direction, such as only enhancing multi-scale fusion effects, only introducing attention mechanisms, or only reducing the number of model parameters, thus having the following drawbacks: 1. Fine-grained features of small targets are easily lost: Pedestrians, vehicles, and cycling targets in drone images usually occupy only a small number of pixels. After multiple stride convolution, pooling or downsampling operations, the discrimination information such as edges, textures, contours and local orientation structures will be rapidly attenuated, ultimately resulting in insufficient feature representation ability of small targets. 2. Complex background interference is difficult to suppress effectively: Background textures such as road markings, trees, buildings, shadows, and densely trafficked areas in aerial images are easily confused with target features. Existing lightweight models have limited ability to suppress background noise and enhance target saliency, and are prone to false detection, false detection, or unstable bounding box localization. 3. Insufficient modeling of local context and geometric structure: Most existing detection structures rely on conventional convolution or ordinary feature fusion methods, which lack explicit modeling of short-range directional context, weak edge continuity and local geometric structure around small targets, making it difficult to make full use of target neighborhood information to improve classification and localization accuracy; 4. Insufficient synergy between semantic information and structural details: Deep features have strong semantic expressive power but low spatial resolution; shallow features retain more spatial details but lack semantic expressive power. Existing methods typically fuse features by serial stacking or simple splicing, which easily causes representational interference between semantic information and geometric details, making it difficult to fully leverage their complementary effects.
[0005] Therefore, providing a lightweight UAV small target detection method and system based on directional context encoding and dual-path feature aggregation to solve the difficulties of the existing technology is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0006] In view of this, the present invention provides a lightweight UAV small target detection method and system based on directional context encoding and dual-path feature aggregation, which improves the detection capability of weak edge, small texture, densely occluded target and low resolution target while maintaining low computational complexity.
[0007] To achieve the above objectives, the present invention adopts the following technical solution: A lightweight UAV small target detection method based on orientation context encoding and dual-path feature aggregation includes the following steps: Acquire drone aerial images and preprocess them to generate a training dataset; The PCFA module replaces the C2F module in the Backbone of the YOLOv8 model, the deepest P5 detection branch in the original YOLOv8 model is deleted, and a P2 prediction path for shallow high-resolution features is added to obtain the lightweight UAV small target detection model DCPA-Det. Input the training dataset into the lightweight UAV small target detection model DCPA-Det, iterate continuously to obtain the optimal weights, and obtain the trained DCPA-Det model. The image to be detected is input into the trained DCPA-Det model, which outputs the detection results of the target category and target location in the image.
[0008] Optionally, the PCFA module includes an LDC unit, an APF unit, a C2f unit, and a convolutional fusion unit. The PCFA module uses LDC as the front end to first transform the input features into local offset enhancement features. The local offset enhancement features are distributed to two parallel paths: one path uses C2F units for stable semantic context aggregation and gradient flow preservation; the other path uses APF units to enhance edges, textures, and geometry. The outputs of the two parallel paths are both adjusted to the C channel, concatenated to form a 2C channel feature, and then fused back to the C channel through a 1×1 convolutional learning method.
[0009] Optionally, LDC cells are used to explicitly introduce a local offset context without reducing spatial resolution, specifically: The boundaries of the input feature map X are zero-paddinged by 1 pixel to obtain the padded image; By extracting four local offset views from the center, right side, bottom side, and bottom right of the filled image, four sub-feature maps with the same spatial dimensions as the original feature map are obtained. The corresponding expressions are: , , , , in, For the central sub-feature map, The right-side sub-feature map, The lower side feature map, The lower right sub-feature map, Represented as input feature map The filled feature map obtained by zero-padding the edges by 1 pixel is, i.e. C is the number of channels, H is the channel height, and W is the channel width; Concatenate the four sub-feature maps according to the channel dimension to obtain a local offset enhancement feature with 4C channels, as shown in the following expression: , ; in, This indicates an operation that stitches features along the channel dimension.
[0010] Optionally, APF elements are used to simultaneously enhance local details, orientation geometry, and channel discriminability, specifically including: Three parallel branches are generated. Their output features are concatenated along the channel dimension, compressed and fused by a 1×1 convolution, multiplied by a fusion scaling factor α, and then added to the shortcut branch of the 1×1 convolution projection. Finally, the output is activated by SiLU. The corresponding expression is: , Where F1, F2, and F3 represent the outputs of the three parallel branches, This represents 1×1 convolution channel compression and fusion. This represents the 1×1 convolution projection of the shortcut branch. Indicates the blending scaling factor. This represents the SiLU activation function.
[0011] Optionally, in the three parallel branches, the first branch uses sequentially connected 1×1 convolutions and 3×3 convolutions to extract local details; The second branch uses sequentially connected 1×5, 5×1 asymmetric convolutions and 5×5 dilated convolutions to enhance the directional edge response and expand the local receptive field. The third branch employs sequentially connected depthwise separable convolutions, pointwise convolutions, and SE channel attention to perform spatial pattern extraction, cross-channel interaction, and channel recalibration with lower overhead.
[0012] A lightweight UAV small target detection system based on orientation context encoding and dual-path feature aggregation is provided to implement the lightweight UAV small target detection method based on orientation context encoding and dual-path feature aggregation described above. The system includes a data acquisition module, a model building module, a model training module, and a target detection module connected in sequence. Data acquisition module: Acquires drone aerial images and preprocesses the drone aerial images to generate a training dataset; Model building module: Replace the C2F module in the Backbone of the YOLOv8 model with the PCFA module, delete the deepest P5 detection branch in the original YOLOv8 model, add the P2 prediction path for shallow high-resolution features, and obtain the lightweight UAV small target detection model DCPA-Det. Model training module: Input the training dataset into the lightweight UAV small target detection model DCPA-Det, iterate continuously to obtain the optimal weights, and obtain the trained DCPA-Det model; Object detection module: Input the image to be detected into the trained DCPA-Det model, and output the object category and object location detection results in the image to be detected.
[0013] As can be seen from the above technical solution, compared with the prior art, the present invention provides a lightweight UAV small target detection method and system based on directional context encoding and dual-path feature aggregation, which has the following beneficial effects: 1) This invention uses the Local Direction Context Encoding (LDC) module to encode local offset information in the center, right, bottom, and lower right directions without reducing the spatial resolution of the feature map. This enables the network to more fully preserve the weak edges, textures, contours, and local continuity information of small targets, thus alleviating the problem of small targets being weakened or erased during convolution and downsampling.
[0014] 2) This invention sets up local convolution branches, directional structure enhancement branches, and depth-separable convolution and SE channel recalibration branches through the APF adaptive parallel fusion module, which can simultaneously extract local details, directional geometry and channel saliency features, thereby reducing the interference of complex background textures such as roads, buildings, trees, and shadows on the detection results.
[0015] 3) This invention uses the PCFA dual-path feature aggregation module to set the C2F semantic aggregation path and the APF structure enhancement path in parallel, so that semantic context information and geometric detail information are learned relatively independently before being fused, avoiding information interference caused by simple concatenation or single-path fusion, and improving the integrity and stability of feature expression.
[0016] 4) This invention removes the traditional deep, low-resolution P5 detection layer and constructs a high-resolution, multi-scale prediction structure composed of P2, P3, and P4, which makes the detection head focus more on shallow and mid-level detailed features, providing better spatial positioning support for targets with a small pixel ratio, dense distribution, or partial occlusion in UAV images.
[0017] 5) While enhancing the feature representation capability, this invention adopts a lightweight feature enhancement and parallel fusion design to avoid excessive parameter and computational load caused by simply stacking large network structures, and can better adapt to application scenarios such as UAV onboard computing platforms, edge devices, and ground station real-time analysis equipment. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0019] Figure 1 This is a schematic diagram of the lightweight UAV small target detection principle based on orientation context encoding and dual-path feature aggregation disclosed in this invention; Figure 2 This is a schematic diagram of the LDC module disclosed in this invention; Figure 3 This is a schematic diagram of the APF module disclosed in this invention; Figure 4 This is a schematic diagram of the PCFA module disclosed in this invention. Detailed Implementation
[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] Reference Figure 1 As shown, this invention discloses a lightweight UAV small target detection method based on orientation context encoding and dual-path feature aggregation, comprising the following steps: Acquire drone aerial images and preprocess them to generate a training dataset; The PCFA module replaces the C2F module in the Backbone of the YOLOv8 model, the deepest P5 detection branch in the original YOLOv8 model is deleted, and a P2 prediction path for shallow high-resolution features is added to obtain the lightweight UAV small target detection model DCPA-Det. Input the training dataset into the lightweight UAV small target detection model DCPA-Det, iterate continuously to obtain the optimal weights, and obtain the trained DCPA-Det model. The image to be detected is input into the trained DCPA-Det model, which outputs the detection results of the target category and target location in the image.
[0022] Furthermore, refer to Figure 4 As shown, the PCFA module includes an LDC unit, an APF unit, a C2f unit, and a convolutional fusion unit. The PCFA module uses the LDC unit as its front end, first transforming the input features into local offset enhancement features. The local offset enhancement features are distributed to two parallel paths: one path uses C2F units for stable semantic context aggregation and gradient flow preservation; the other path uses APF units to enhance edges, textures, and geometry. The outputs of the two parallel paths are both adjusted to the C channel, concatenated to form a 2C channel feature, and then fused back to the C channel through a 1×1 convolutional learning method.
[0023] Furthermore, the key feature fusion relationship of the PCFA module can be expressed as: , , , ; Where X is the input feature map, F_LDC represents Local Offset Context Encoding, F_C2F represents the Semantic Aggregation Path, F_APF represents the Structural Enhancement Path, F_fuse represents the 1×1 Convolutional Fusion Operation, and Y is the PCFA output feature. The above formula defines the dual-path collaborative approach of this invention: LDC first provides local offset enhancement features, then the C2F and APF paths learn semantic context and geometric structure information respectively, and finally, they are fused through learnable channels to form the output features for use in subsequent feature pyramids.
[0024] This dual-path parallel design avoids the information interference caused by simply concatenating semantic enhancement and structural enhancement, enabling semantic cues and geometric cues to learn relatively independently, and then achieving collaborative expression through lightweight channel mixing.
[0025] Furthermore, refer to Figure 2 As shown, LDC cells are used to explicitly introduce local offset contexts without reducing spatial resolution, specifically as follows: The boundaries of the input feature map X are zero-paddinged by 1 pixel to obtain the padded image; By extracting four local offset views from the center, right side, bottom side, and bottom right of the filled image, four sub-feature maps with the same spatial dimensions as the original feature map are obtained. The corresponding expressions are: , , , , in, For the central sub-feature map, The right-side sub-feature map, The lower side feature map, The lower right sub-feature map, Represented as input feature map The filled feature map obtained by zero-padding the edges by 1 pixel is, i.e. C is the number of channels, H is the channel height, and W is the channel width; Concatenate the four sub-feature maps according to the channel dimension to obtain a local offset enhancement feature with 4C channels, as shown in the following expression: , ; in, This expression represents the operation of feature stitching along the channel dimension. It describes how an LDC unit encodes the information of the four neighborhood directions (center, right, bottom, and bottom right) into the channel dimension without reducing the spatial resolution.
[0026] Furthermore, the LDC unit does not directly compute gradients or perform spatial-to-channel downsampling rearrangement. Instead, it preserves continuity within the minimum 2×2 neighborhood through feature translation sampling. Subsequent convolutional layers can learn orientation-selective responses based on these offset views, thereby enhancing the edge, texture, and local structural information of small objects.
[0027] Furthermore, refer to Figure 3 As shown, the APF element is used to simultaneously enhance local details, directional geometry, and channel discriminability, specifically including: Three parallel branches are generated. Their output features are concatenated along the channel dimension, compressed and fused by a 1×1 convolution, multiplied by a fusion scaling factor α, and then added to the shortcut branch of the 1×1 convolution projection. Finally, the output is activated by SiLU. The corresponding expression is: , Where F1, F2, and F3 represent the outputs of the three parallel branches, This represents 1×1 convolution channel compression and fusion. This represents the 1×1 convolution projection of the shortcut branch. Indicates the blending scaling factor. This represents the SiLU activation function.
[0028] Specifically, through the above relationships, the APF unit, while maintaining the stable transmission of input features, injects local details, directional structure, and channel saliency information into the output features to enhance the detectability of small targets in complex backgrounds.
[0029] The role of APF is to simultaneously enhance local details, directional geometry, and channel discriminability, thereby suppressing complex background noise and improving the separability of small targets.
[0030] Furthermore, in the three parallel branches, the first branch uses sequentially connected 1×1 convolutions and 3×3 convolutions to extract local details; The second branch uses sequentially connected 1×5, 5×1 asymmetric convolutions and 5×5 dilated convolutions to enhance the directional edge response and expand the local receptive field. The third branch employs sequentially connected depthwise separable convolutions, pointwise convolutions, and SE channel attention to perform spatial pattern extraction, cross-channel interaction, and channel recalibration with lower overhead.
[0031] Furthermore, the deepest P5 stage in traditional YOLOv8 is removed, and a new P2 prediction path for shallow, high-resolution features is added, forming a three-scale detection head: P2-P3-P4. When inputting a 640×640 image, three prediction layers (P2, P3, and P4) are formed with strides of approximately 4, 8, and 16, respectively, corresponding to feature map sizes of approximately 160×160, 80×80, and 40×40. Compared to the traditional P5 prediction layer with a stride of 32, the P2-P3-P4 structure provides denser spatial sampling for small targets. For targets approximately 20 pixels high, the traditional P5 layer covers only about 0.6 grid cells, providing insufficient localization support; while P4, P3, and P2 cover approximately 1.25, 2.5, and 5 grid cells, respectively, which is more beneficial for small target recall and boundary localization. This structure retains P4 to maintain a certain level of semantic abstraction, while improving spatial detail sensitivity through P2 and P3.
[0032] A lightweight UAV small target detection system based on orientation context encoding and dual-path feature aggregation is provided to implement the lightweight UAV small target detection method based on orientation context encoding and dual-path feature aggregation described above. The system includes a data acquisition module, a model building module, a model training module, and a target detection module connected in sequence. Data acquisition module: Acquires drone aerial images and preprocesses the drone aerial images to generate a training dataset; Model building module: Replace the C2F module in the Backbone of the YOLOv8 model with the PCFA module, delete the deepest P5 detection branch in the original YOLOv8 model, add the P2 prediction path for shallow high-resolution features, and obtain the lightweight UAV small target detection model DCPA-Det. Model training module: Input the training dataset into the lightweight UAV small target detection model DCPA-Det, iterate continuously to obtain the optimal weights, and obtain the trained DCPA-Det model; Object detection module: Input the image to be detected into the trained DCPA-Det model, and output the object category and object location detection results in the image to be detected.
[0033] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A lightweight UAV small target detection method based on directional context encoding and dual-path feature aggregation, characterized in that, Includes the following steps: Acquire drone aerial images and preprocess them to generate a training dataset; The PCFA module replaces the C2F module in the Backbone of the YOLOv8 model, the deepest P5 detection branch in the original YOLOv8 model is deleted, and a P2 prediction path for shallow high-resolution features is added to obtain the lightweight UAV small target detection model DCPA-Det. Input the training dataset into the lightweight UAV small target detection model DCPA-Det, iterate continuously to obtain the optimal weights, and obtain the trained DCPA-Det model. The image to be detected is input into the trained DCPA-Det model, which outputs the detection results of the target category and target location in the image.
2. The lightweight UAV small target detection method based on directional context encoding and dual-path feature aggregation according to claim 1, characterized in that, The PCFA module includes an LDC unit, an APF unit, a C2f unit, and a convolutional fusion unit. The PCFA module uses the LDC unit as its front end, first transforming the input features into local offset enhancement features. The local offset enhancement features are distributed to two parallel paths: one path uses C2F units for stable semantic context aggregation and gradient flow preservation; the other path uses APF units to enhance edges, textures, and geometry. The outputs of the two parallel paths are both adjusted to the C channel, concatenated to form a 2C channel feature, and then fused back to the C channel through a 1×1 convolutional learning method.
3. A lightweight UAV small target detection method based on directional context encoding and dual-path feature aggregation according to claim 2, characterized in that, LDC units are used to explicitly introduce local offset contexts without reducing spatial resolution. Specifically: The boundaries of the input feature map X are zero-paddinged by 1 pixel to obtain the padded image; By extracting four local offset views from the center, right side, bottom side, and bottom right of the filled image, four sub-feature maps with the same spatial dimensions as the original feature map are obtained. The corresponding expressions are: , , , , in, For the central sub-feature map, The right-side sub-feature map, The lower side feature map, The lower right sub-feature map, Represented as input feature map The filled feature map obtained by zero-padding the edges by 1 pixel is, i.e. C is the number of channels, H is the channel height, and W is the channel width; Concatenate the four sub-feature maps according to the channel dimension to obtain a local offset enhancement feature with 4C channels, as shown in the following expression: , ; in, This indicates an operation that stitches features along the channel dimension.
4. A lightweight UAV small target detection method based on directional context encoding and dual-path feature aggregation according to claim 2, characterized in that, APF elements are used to simultaneously enhance local details, directional geometry, and channel discrimination, specifically including: Three parallel branches are generated. Their output features are concatenated along the channel dimension, compressed and fused by a 1×1 convolution, multiplied by a fusion scaling factor α, and then added to the shortcut branch of the 1×1 convolution projection. Finally, the output is activated by SiLU. The corresponding expression is: , Where F1, F2, and F3 represent the outputs of the three parallel branches, This represents 1×1 convolution channel compression and fusion. This represents the 1×1 convolution projection of the shortcut branch. Indicates the blending scaling factor. This represents the SiLU activation function.
5. A lightweight UAV small target detection method based on directional context encoding and dual-path feature aggregation according to claim 4, characterized in that, In the three parallel branches, the first branch uses sequentially connected 1×1 convolutions and 3×3 convolutions to extract local details; The second branch uses sequentially connected 1×5, 5×1 asymmetric convolutions and 5×5 dilated convolutions to enhance the directional edge response and expand the local receptive field. The third branch employs sequentially connected depthwise separable convolutions, pointwise convolutions, and SE channel attention to perform spatial pattern extraction, cross-channel interaction, and channel recalibration with lower overhead.
6. A lightweight UAV small target detection system based on orientation context encoding and dual-path feature aggregation, applied to the lightweight UAV small target detection method based on orientation context encoding and dual-path feature aggregation as described in any one of claims 1-5, characterized in that, It includes a data acquisition module, a model building module, a model training module, and an object detection module connected in sequence; Data acquisition module: Acquires drone aerial images and preprocesses the drone aerial images to generate a training dataset; Model building module: Replace the C2F module in the Backbone of the YOLOv8 model with the PCFA module, delete the deepest P5 detection branch in the original YOLOv8 model, add the P2 prediction path for shallow high-resolution features, and obtain the lightweight UAV small target detection model DCPA-Det. Model training module: Input the training dataset into the lightweight UAV small target detection model DCPA-Det, iterate continuously to obtain the optimal weights, and obtain the trained DCPA-Det model; Object detection module: Input the image to be detected into the trained DCPA-Det model, and output the object category and object location detection results in the image to be detected.