Unmanned aerial vehicle target detection method and system based on multi-scale fusion and dynamic perception
By introducing a multi-scale fusion module and a dynamic sensing detection head into the YOLOv5s neural network, the problem of low detection accuracy of small targets from the perspective of a drone is solved, and high-precision target detection in scenes with large scale changes and dense occlusion is achieved.
Patent Information
- Application Number
- CN202410838757.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-09-10
AI Technical Summary
Existing target detection algorithms are unsatisfactory in small target detection tasks from the perspective of UAVs. Especially in scenes with large scale changes and dense occlusion, the detection accuracy is low and cannot adapt to the complex environment of UAVs.
Based on the YOLOv5s neural network, a multi-scale fusion module and a dynamic perception detection head are introduced to filter occlusion information through multi-scale feature fusion. A dynamic perception detection head is designed to locate and classify targets of different sizes. It combines deformable convolution, RepVGG and CARAFE modules to improve detection. Accuracy.
Significantly improves the accuracy and accuracy of UAV target detection, especially in scenes with large scale changes and dense occlusion, and improves the classification and positioning accuracy of small targets.
Smart Images

Figure CN118628940A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of target detection, and in particular to a method and system for detecting unmanned aerial vehicle targets based on multi-scale fusion and dynamic perception. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] In recent years, drone technology has developed rapidly. Due to its fast and flexible image acquisition capabilities, it has gradually been applied to various fields, such as urban planning, inspection, geological exploration, search and rescue, etc. Target detection technology is one of the key technologies for drones to be used in many scenarios. It is very important to study the small target detection algorithm from the perspective of drones. After the introduction of deep learning technology, target detection technology based on convolutional neural network (CNN) has been continuously developed, making it possible for drones to automatically detect ground targets.
[0004] Although the target detection method has achieved high accuracy in general target detection scenarios, the detection effect is not ideal when used for target detection tasks in drone scenarios. Today, target detection algorithms are mostly targeted at conventional detection scenarios. Target detection tasks from the perspective of drones need to be optimized using relevant methods. The factors that affect the accuracy of small target detection from the perspective of drones are as follows: the flight altitude varies greatly, and the scale of objects in the captured image varies greatly; there is a dense occlusion problem for drone detection objects, which seriously affects the border positioning and classification effect; the number of small-scale targets in the field of view accounts for a large proportion, which is easily affected by the downsampling operation of the detection model; therefore, the existing target detection scheme is not suitable for drone target detection scenarios with large scale changes, dense occlusion and too many small targets. Summary of the invention
[0005] In order to overcome the shortcomings of the above-mentioned prior art, the present invention provides a UAV target detection method and system based on multi-scale fusion and dynamic perception, which can accurately locate and classify target objects with large scale changes, overcome the problems of dense occlusion between objects and small target detection, and improve the detection accuracy of the model for related detection environments.
[0006] To achieve the above objectives, one or more embodiments of the present invention provide the following technical solutions:
[0007] A first aspect of the present invention provides a UAV target detection method based on multi-scale fusion and dynamic perception.
[0008] The UAV target detection method based on multi-scale fusion and dynamic perception includes:
[0009] Obtain aerial images of the drone to be detected;
[0010] Input the drone aerial images into the trained target detection model to locate and classify targets of different sizes and obtain target detection results;
[0011] Among them, the target detection model, based on the YOLOv5s neural network, introduces a multi-scale fusion module and a dynamic perception detection head. The multi-scale fusion module is used to fuse multi-scale features, filter out useless occlusion information, and obtain an accurate target feature map. The dynamic perception detection head is used to locate and classify targets of different sizes.
[0012] Furthermore, the target detection model includes a backbone network, a neck network and a head network connected in sequence;
[0013] The backbone network is used for hierarchical feature extraction;
[0014] The neck network is used to filter and fuse the hierarchically extracted features to obtain a target feature map;
[0015] The head network is used to locate and classify objects of different sizes using the object feature map.
[0016] Further, the backbone network includes a first CBS module, a second CBS module, a first C3_1 module, a third CBS module, a second C3_1 module, a fourth CBS module, a third C3_1 module, a fifth CBS module, a fourth C3_1 module and an SPPF module arranged in sequence;
[0017] The CBS module is used to downsample and upsample the input image;
[0018] The C3_1 module is used to perform hierarchical feature extraction on the input image;
[0019] The SPPF module is used to perform a pooling operation on the input image.
[0020] Furthermore, the neck network includes a sixth CBS module, a first multi-scale fusion module, a first C3_2 module, a seventh CBS module, a first multi-scale fusion module, a second C3_2 module, an eighth CBS module, a third multi-scale fusion module, a third C3_2 module, a ninth CBS module, a fourth Concat module, a fourth C3_2 module, a tenth CBS module, a fifth Concat module, a fifth C3_2 module, an eleventh CBS module, a sixth Concat module, and a sixth C3_2 module, which are arranged in sequence.
[0021] Furthermore, the multi-scale features fused by the multi-scale fusion module include a large-scale feature map, a medium-scale feature map and a small-scale feature map, which respectively correspond to the three levels of features extracted from the backbone network;
[0022] The large-scale feature map of the first multi-scale fusion module comes from the third C3_1 module, the medium-scale feature map comes from the second C3_1 module, and the small-scale feature map comes from the sixth CBS module;
[0023] The large-scale feature map of the second multi-scale fusion module comes from the second C3_1 module, the medium-scale feature map comes from the first C3_1 module, and the small-scale feature map comes from the seventh CBS module;
[0024] The large-scale feature map of the third multi-scale fusion module comes from the first C3_1 module, the medium-scale feature map comes from the first CBS module, and the small-scale feature map comes from the eighth CBS module.
[0025] Further, the head network includes a first dynamic perception detection head, a second dynamic perception detection head, a third dynamic perception detection head and a fourth dynamic perception detection head;
[0026] The input ends of the first dynamic perception detection head, the second dynamic perception detection head, the third dynamic perception detection head and the fourth dynamic perception detection head are respectively connected to the output ends of the third C3_2 module, the fourth C3_2 module, the fifth C3_2 module and the sixth C3_2 module;
[0027] From the fourth motion-aware detection head to the first motion-aware detection head, the objects to be located and classified gradually become smaller.
[0028] Furthermore, the dynamic perception detection head includes a convolution block, a deformable convolution module, a positioning branch and a classification branch;
[0029] The convolution block is used to perform feature extraction and channel restriction on the input feature map;
[0030] The deformable convolution module is used to enhance and extract the semantic information in the feature map output by the convolution block through its own unique perception ability, so as to obtain a feature map with enhanced semantic information;
[0031] The positioning branch is used to extract the positioning information of the target to be detected from the feature map enhanced by semantic information;
[0032] The classification branch is used to predict the category information of the target from the feature map enhanced with semantic information.
[0033] A second aspect of the present invention provides an unmanned aerial vehicle target detection system based on multi-scale fusion and dynamic perception.
[0034] The UAV target detection system based on multi-scale fusion and dynamic perception includes:
[0035] The acquisition module is configured to: acquire an aerial picture of the drone to be detected;
[0036] The detection module is configured to: input the drone aerial image into the trained target detection model, locate and classify targets of different sizes, and obtain target detection results;
[0037] Among them, the target detection model, based on the YOLOv5s neural network, introduces a multi-scale fusion module and a dynamic perception detection head. The multi-scale fusion module is used to fuse multi-scale features, filter out useless occlusion information, and obtain an accurate target feature map. The dynamic perception detection head is used to locate and classify targets of different sizes.
[0038] A third aspect of the present invention provides a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the steps in the method for detecting unmanned aerial vehicle targets based on multi-scale fusion and dynamic perception as described in the first aspect of the present invention.
[0039] The fourth aspect of the present invention provides an electronic device, including a memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, the steps in the drone target detection method based on multi-scale fusion and dynamic perception as described in the first aspect of the present invention are implemented.
[0040] One or more of the above technical solutions have the following beneficial effects:
[0041] The present invention improves the YOLOv5s neural network, including introducing a multi-scale fusion module and a dynamic perception detection head:
[0042] (1) The present invention designs a dynamic perception detection head. By setting multiple dynamic perception detection heads for different scales, feature information is integrated into classification and positioning, and targets of different sizes are positioned and classified, thereby accurately positioning and classifying objects with large scale changes.
[0043] (2) The present invention designs a multi-scale fusion module (MultiConcat) to fuse multi-scale information and filter out useless occlusion information, so as to overcome the problems of dense occlusion between objects and small target detection, and improve the detection accuracy of the model for related detection environments.
[0044] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0046] Figure 1 This is a flow chart of the method of the first embodiment.
[0047] Figure 2 This is a diagram of the improved network model based on YOLOv5 in the first embodiment;
[0048] Figure 3 This is a structural diagram of a dynamic sensing decoupling head of the first embodiment;
[0049] Figure 4 Schematic diagram of a multi-scale fusion module (MultiCancat) of the first embodiment; DETAILED DESCRIPTION
[0050] It should be noted that the following detailed descriptions are illustrative and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used in the present invention have the same meanings as those commonly understood by those skilled in the art to which the present application belongs.
[0051] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0052] Target detection in drone aerial photography requires the model to have high detection performance while facilitating the deployment of drone platforms and saving onboard resources as much as possible. The YOLOv5 algorithm has excellent speed and flexibility, and has a strong advantage in drone platform deployment. YOLOv5s is obtained by scaling the width and depth on the basis of YOLOv5 l, with a smaller model volume and higher detection rate. Therefore, the present invention is based on YOLOv5s and improves the difficulties of drone aerial photography target detection.
[0053] Embodiment 1
[0054] In one embodiment of the present disclosure, a method for detecting a drone target based on multi-scale fusion and dynamic perception is provided, comprising the following steps:
[0055] Obtain aerial images of the drone to be detected;
[0056] Input the drone aerial images into the trained target detection model to locate and classify targets of different sizes and obtain target detection results;
[0057] Among them, the target detection model, based on the YOLOv5s neural network, introduces a multi-scale fusion module and a dynamic perception detection head. The multi-scale fusion module is used to fuse multi-scale features, filter out useless occlusion information, and obtain an accurate target feature map. The dynamic perception detection head is used to locate and classify targets of different sizes.
[0058] The target detection model is the key to the drone target detection method described in this embodiment, and its main improvements are:
[0059] (1) In order to solve the problem of large scale changes of the target to be detected, this embodiment adds a deformable convolution module to the front end of the detection head to solve the scale change problem of the target object. In addition, RepVGG is added to the positioning branch. Without introducing branch parameters, a 1X1 convolution module is used to promote positioning; and a spatial convolution module is added to the classification branch to promote the classification ability of the detection head. In addition, in order to solve the problem that the information between the positioning and classification tasks cannot be shared due to the separation of the positioning and classification tasks, a parameter sharing module is added between the classification branch and the positioning branch, thereby promoting information exchange between the two branches.
[0060] (2) To address the problems of dense occlusion and too many small targets in drone detection, this embodiment deeply fuses feature maps of large, medium and small scales. The main idea is to provide detailed and rich semantic information through small-scale targets of larger scales, and to filter useless occlusion information through small scales and provide high-level semantic information. The small-scale feature map is generated by the upsampling module carafe, which can aggregate deep context information and enhance content perception in a large receptive field, thereby improving detection performance. Finally, the three scales are mixed using channels to achieve deep fusion of the three types of information.
[0061] From the perspective of target detection model construction and training, the implementation process of the drone target detection method based on multi-scale fusion and dynamic perception in this embodiment is described in detail below. The specific process is as follows:
[0062] S1. Enhance the data in the original data set to obtain the target data set, and split the target data set according to the batch size to obtain the target sub-data set, specifically:
[0063] (1) Load the original dataset, perform data enhancement on the images in the loaded original dataset, and obtain the target dataset.
[0064] Use the create_dataloader function to load the original dataset, where the original dataset is the VisDrone dataset. The VisDrone dataset is an existing dataset that can be obtained from http: / / aiskyeye.com / home / . The VisDrone dataset is a small target detection dataset from the perspective of a drone.
[0065] Data enhancement processing is performed on the images in the loaded original data set to obtain data enhanced images; wherein the data enhancement processing includes hue enhancement hsv_h, saturation enhancement hsv_s, brightness enhancement hsv_v, translation, scaling, upside down and mosaic enhancement operations performed in sequence, and the preset parameters of the above data enhancement operations are 0.015, 0.7, 0.4, 0.1, 0.5, 0.5, and 1.0, respectively, wherein the preset parameters of hue enhancement hsv_h, saturation enhancement hsv_s, brightness enhancement hsv_v, translation, and scaling respectively represent the processing amplitude of the data enhancement operation, and the preset parameters of upside down and mosaic enhancement respectively represent the probability of performing the data enhancement operation; after data enhancement processing, data enhanced images and labels can be obtained, and these data enhanced images and labels constitute the target data set.
[0066] (2) Split the target dataset according to the batch size to obtain multiple target sub-datasets.
[0067] In the create_dataloader function, the torch.utils.data.DataLoader function is used to split the target dataset according to the batch size to obtain multiple target sub-datasets.
[0068] S2. Build YOLOv5 neural network
[0069] The structure of the YOLOv5 neural network is as follows Figure 2 As shown, it includes an Input layer, a backbone network, a neck network and a head network connected in sequence, wherein the backbone network, the neck network and the head network after training are used as target detection models for subsequent target detection.
[0070] The input layer is used to input the images and labels in the target sub-dataset into the YOLOv5 neural network; the image size of the images in the target sub-dataset is 640×640×3.
[0071] 1. Structure and Function of Backbone Network
[0072] The backbone network in the YOLOv5 neural network in this embodiment has the same structure and function as the backbone network in the existing YOLOv5s neural network. The existing YOLOv5s neural network in this embodiment refers to the YOLOv5s neural network disclosed in the original YOLOv5s method (from https: / / github.com / ultralytics / yolov5);
[0073] The specific structure of the backbone network in this embodiment is as follows: Figure 2 As shown, the backbone network includes a first CBS module, a second CBS module, a first C3_1 module, a third CBS module, a second C3_1 module, a fourth CBS module, a third C3_1 module, a fifth CBS module, a fourth C3_1 module and an SPPF module which are arranged in sequence.
[0074] The first CBS module to the fifth CBS module have the same structure and function, and are all used to downsample and upsample feature maps. The first CBS module to the fifth CBS module are composed of a Conv layer, a BN layer, and a Silu activation function layer connected in sequence, and the convolution kernel size of the Conv layer is 3×3.
[0075] The C3_1 module in the backbone network of this embodiment is the C3 module in the backbone network of the existing YOLOv5s neural network; and the SPPF module is used to perform a pooling operation on the input feature map;
[0076] 2. Structure and function of the neck network
[0077] The Neck network in the YOLOv5 neural network of this embodiment is improved based on the Neck network of the existing YOLOv5s neural network. The neck network in the YOLOv5 neural network constructed in this embodiment is used to extract deep features and fuse shallow features, relatively shallow features and deep features to achieve multi-scale feature analysis of feature information by the network; in addition, a shallower feature fusion strategy is added to the neck network to increase the information of small targets; secondly, a new upsampling module is added to retain deep beneficial information through content-aware capabilities.
[0078] The improvements of the Neck network in the YOLOv5 neural network of this embodiment compared with the Neck network of the existing YOLOv5s neural network are as follows:
[0079] (1) All Upsample layers in the neck network are deleted uniformly;
[0080] (2) All Concat modules in the neck network are replaced with MultiConcat modules. There are three MultiConcat modules in total. Figure 2 Shown, from top to bottom, are the first MultiConcat module, the second MultiConcat module, and the third MultiConcat module.
[0081] Among them, the first to third MultiConcat modules are constructed by the inventors themselves, and their main structures are as follows: Figure 4 As shown in the figure, its main function is to perform deep feature fusion of shallow features, relatively shallow features and deep features from the backbone network, so that the model can overcome the problems of dense occlusion between objects and small target detection by fusing multi-scale information.
[0082] The MultiConcat module mainly has three branch operations, which operate on large-scale feature maps (shallow feature maps), medium-scale feature maps (shallower feature maps), and small-scale feature maps (deep feature maps):
[0083] 1) For large-scale feature maps, the convolution module is first used to extract features from the input feature maps, and the extracted feature maps are respectively sent to the parallel maximum pooling branch and the average pooling branch; the two branches downsample the feature maps, and the matrix addition operation is performed on the feature maps output by the two branches, and the two feature maps with different rich semantic information are fused, so that more favorable features can be preserved; the output feature map containing rich language is input to the convolution module, and then deep feature fusion is performed;
[0084] 2) For mesoscale features, the mesoscale feature map is sent to the convolution module for feature extraction;
[0085] 3) For small-scale feature maps, the CARAFE module is first used to upsample the small-scale feature maps, and the content perception ability of the CARAFE module is used to generate deep feature maps with more favorable information; then the convolution module is used to extract features from the generated feature maps with rich deep features. Finally, the Concat operation is used to fuse the feature maps from the three branches, and the channel mixing operation is performed on the fused feature maps to perform deep fusion on the fused feature maps.
[0086] Among them, the convolution module used in the MultiConcat module has the same structure as the CBS module in the backbone network.
[0087] In addition, the CARAFE module adopts a conventional structure, including two main modules: an upsampling kernel prediction module and a feature reorganization module. Assuming that the upsampling ratio is σ, given an input feature map of shape H×W×CH, CARAFE first uses the upsampling kernel prediction module to predict the upsampling kernel, and then uses the feature reorganization module to complete the upsampling, and obtains an output feature map of shape σH×σW×C. And the functions of the first CARAFE module to the third CARAFE module in this embodiment are also the same, all of which are used to aggregate context information of different depths for the feature maps input therein in a large receptive field, and output feature maps with context information of different depths. Since the CARAFE module in this embodiment can aggregate context information of different depths for the feature maps input therein in a large receptive field, the setting of the CARAFE module can make the YOLOv5 neural network constructed in this embodiment have better content perception ability.
[0088] The large-scale feature map of the first multiConcat module comes from the third C3_1 module, the medium-scale feature map comes from the second C3_1 module, and the small-scale feature map comes from the sixth CBS module;
[0089] The large-scale feature map of the second multiConcat module comes from the second C3_1 module, the medium-scale feature map comes from the first C3_1 module, and the small-scale feature map comes from the seventh CBS module;
[0090] The large-scale feature map of the third multiConcat module comes from the first C3_1 module, the medium-scale feature map comes from the first CBS module, and the small-scale feature map comes from the eighth CBS module.
[0091] (3) Adding a shallower feature fusion strategy: In the neck network, between the second MultiConcat layer and the CBS module connected to its output end, add the second C3_2 module, the eighth CBS module, the third MultiConcat layer, the third C3_2 module, the ninth CBS module, the first Concat layer, and the fourth C3_2 module, which are connected in sequence.
[0092] Among them, the second C3_2 module is connected to the output end of the second MultiConcat layer, the output end of the fourth C3_2 module is connected to the tenth CBS module, and the tenth CBS module is the CBS module connected to the output end of the second Concat layer in the YOLOv5s neural network; the input end of the third MultiConcat layer is connected to the output end of the first C3_1 module, and the output end of the eighth CBS module is connected to the input end of the first Concat layer.
[0093] Since the feature map output by the second Concat layer in the existing YOLOv5s neural network has a small scale and contains less small target information, this embodiment adds a second C3_2 module, an eighth CBS module, a third MultiConcat layer, a third C3_2 module, a ninth CBS module, a first Concat layer, and a fourth C3_2 module, which are connected in sequence between the second MultiConcat layer and the CBS module connected to its output end.
[0094] Among them, the second C3_2 module is connected to the output end of the second MultiConcat layer, and the output end of the fourth C3_2 module is connected to the tenth CBS module. The tenth CBS module is the setting of the CBS module connected to the output end of the second MultiConcat layer in the YOLOv5s neural network to extract the deep features in the feature map and perform upsampling operations to increase the scale of the feature map so that the feature map contains more small target semantic information.
[0095] The first CBS module, the first C3_1 module, and the eighth CBS module are all connected to the input end of the third MultiConcat layer, which enables the third MultiConcat layer to perform multi-scale fusion on the shallow features of the feature map output by the first CBS module (the features contain rich small target information), the shallower features in the feature map output by the first C3_1 module (the shallower features contain richer small target information), and the deep features in the feature map output by the eighth CBS module. The eighth CBS module and the ninth CBS module are both connected to the input end of the first Concat layer to further fuse the shallow features, the shallower features, and the deep features, so that the feature map output by the first Concat layer contains more small target semantic information;
[0096] Among them, the sixth CBS module to the eleventh CBS module have the same structure and function, and are all used to downsample and upgrade the feature map. The sixth CBS module to the eleventh CBS module are composed of a Conv layer, a BN layer, and a Silu activation function layer connected in sequence, wherein the convolution kernel size of the Conv layer is 3×3; and the C3_2 module in the neck network is the C3 module in the neck network in the existing YOLOv5s neural network; the C3_1 module and the C3_2 module have the same structure, but different shortcut parameters, the shortcut parameter in the C3_1 module is True, and the shortcut parameter in the C3_2 module is False;
[0097] 3. Structure and Function of Head Network
[0098] The head network constructed in this embodiment has a different structure and function from the head network in the existing YOLOv5s neural network. The new head network constructed in this embodiment replaces the head network in the existing YOLOv5s neural network, and is used to dynamically extract information in the feature map output by the neck network, locate and classify targets of different sizes, and output Cls, Obj and Reg of targets of different sizes, where Obj represents the confidence of the predicted target, Reg represents the bounding box information of the predicted target, and Cls represents the category of the predicted target.
[0099] The structure of the head network in this embodiment is as follows: Figure 1 As shown, it includes a first dynamic perception detection head, a second dynamic perception detection head, a third dynamic perception detection head and a fourth dynamic perception detection head, and the input ends of the first dynamic perception detection head, the second dynamic perception detection head, the third dynamic perception detection head and the fourth dynamic perception detection head are respectively connected to the output ends of the third C3_2 module, the fourth C3_2 module, the fifth C3_2 module and the sixth C3_2 module;
[0100] Among them, the first dynamic perception detection head to the fourth dynamic perception detection head have the same structure and function. Among them, the first dynamic perception detection head to the fourth dynamic perception detection head all dynamically extract information in the feature map output by the neck network, and locate and classify targets of different sizes in the feature map; the targets located and classified by the fourth dynamic perception detection head, the third dynamic perception detection head, the second dynamic perception detection head, and the first dynamic perception detection head gradually become smaller, and the first dynamic perception detection head can locate and classify more small targets in the feature map.
[0101] Taking the structure of the first dynamic perception detection head as an example, the structure of the first dynamic perception detection head is as follows Figure 3 As shown, the first dynamic perception detection head includes a convolution block and a deformable convolution module connected in sequence, the deformable convolution modules are respectively connected to a positioning branch and a classification branch connected in parallel, the positioning branch includes a first RepVGG module, a second RepVGG module and a third RepVGG module connected in sequence, the classification branch includes a first spatial convolution module, a second ordinary convolution module and a third spatial convolution module connected in sequence; the deformable convolution module is respectively connected to the first RepVGG module of the positioning branch and the first spatial convolution module of the classification branch.
[0102] In addition, a parameter sharing module (union module) is added between the classification branch and the localization branch to promote information interaction between the two branches. Specifically:
[0103] The first RepVGG module and the first convolution module are connected to the first union module at the same time, and the second RepVGG module and the second spatial convolution module are connected to the second union module at the same time. Then the two union modules are combined with the output feature maps of the two branch modules connected to them through matrix addition operations.
[0104] In addition, the RepVGG module adopts a conventional module structure, including a 3x3 convolution layer (with ReLU activation function), an optional 1x1 convolution layer (for channel transformation and dimensionality reduction) and an additional 3x3 convolution layer; during training, these components exist in parallel to form a multi-branch structure, similar to the residual connection in ResNet; but during reasoning, through a specific reparameterization method, these branches will be merged into a simple 3x3 convolution layer plus a bias term; the spatial convolution module is composed of CBAM spatial attention and CBS modules in series, and the union module is composed of CBS modules with 1x1 convolution kernels.
[0105] In addition, CBAM spatial attention adopts a conventional module structure, and its structural operation is as follows: first, the input feature map is subjected to global maximum pooling and global average pooling respectively to obtain two feature descriptions of different dimensions. Then, the pooled feature maps share a multi-layer perceptron network, first through a fully connected layer to reduce the feature dimension, and then through a fully connected layer to increase the feature dimension. The two feature maps are stacked in the channel dimension, and the weight of each channel of the feature map is normalized to between 0 and 1 through the sigmoid activation function. Finally, the normalized weight is multiplied by the input feature map to obtain the processed feature map. For the input feature layer, the maximum value and average value are taken on the channel of each feature point, and the height and width of the feature map remain unchanged. This is equivalent to flattening the input feature map, and the number of channels becomes 1. The two results are then stacked. Then, a 7*7 convolution kernel is used to fuse the channel information, and the feature map changes from [B, 2, H, W] to [B, 1, H, W]. Then, the Sigmoid function is used to obtain the weight (between 0 and 1) of each feature point in the input feature layer. Finally, multiply this weight by the original input feature layer.
[0106] The convolution block in the dynamic perception detection head of this embodiment is similar to the CBS module structure and is used to perform feature extraction and channel restriction on the feature map input therein. When the number of channels of the feature map in the convolution block of the dynamic perception detection head is greater than 256, the convolution block performs feature extraction on the feature map and reduces the number of channels to 256. When the number of channels of the feature map in the convolution block of the dynamic perception detection head is less than or equal to 256, the convolution block only performs feature extraction on the feature map without performing dimensionality reduction operation.
[0107] The deformable convolution module is used to enhance and extract the semantic information in the feature map output by the convolution block through its own unique perception ability, and obtain a feature map with enhanced semantic information;
[0108] The variable convolution module adopts a conventional module structure, which mainly consists of an offset prediction module and a convolution operation with an offset.
[0109] Offset prediction module: First, a lightweight convolutional layer is used to predict the offset of each output position on the input feature map. These offsets reflect the most relevant feature region position in the current context.
[0110] Convolution operation with offset: Then, the original input feature map is sampled using the predicted offset instead of sampling on a regular grid. That is, the filter is no longer translated at a fixed step size, but jumps to the new sampling point according to the offset for weighted summation to generate the final feature map.
[0111] The first RepVGG module is used to extract position information and perform dimensionality reduction operations on the feature map with rich information output by the variability convolution module to obtain a feature map with position information, and the generated feature map is sent to the first union module and the second RepVGG module respectively.
[0112] The first spatial convolution module accepts the feature map from the variable convolution, and through the simultaneous processing of the CBAM attention and convolution modules, the output feature map has rich spatial information, thereby generating rich classification information. At the same time, the generated feature map is sent to the first union module and the second spatial convolution module respectively.
[0113] The first union module fuses the rich positioning information and classification information, and outputs beneficial shared information. It also adds the shared information to the feature map output by the first RepVGG module to the second RepVGG module and the output by the first spatial convolution module to the second spatial convolution module through matrix addition operations.
[0114] The second RepVGG module is used to further extract the position information and reduce the dimension of the feature map with shared information and position information after matrix addition, so as to obtain a feature map with less position noise and richer position information. The generated feature map is sent to the second union module and the third RepVGG module respectively.
[0115] The second spatial convolution module is used to further extract features and perform spatial feature weighting on the feature map output by matrix addition, and send the generated feature map to the second union module and the third spatial convolution module respectively;
[0116] The second union module deeply fuses the rich positioning information and classification, and outputs more favorable shared information. It also adds the shared information to the feature map output by the second RepVGG module to the third RepVGG module and the output by the second spatial convolution module to the third spatial convolution module through matrix addition operations.
[0117] The third RepVGG module is used to predict the location information of the target to be detected based on the feature map output after matrix addition, and output Obj and Reg, where Obj represents the confidence of the predicted target and Reg represents the bounding box information of the predicted target.
[0118] The third spatial convolution module predicts the category information of the target for the feature map output after matrix addition, and outputs Cls, where Cls represents the category of the predicted target.
[0119] S3, using the target sub-dataset to train the YOLOv5 neural network to obtain a YOLOv5 neural network model;
[0120] (1) Constructing a loss function. The loss function constructed in this embodiment is the same as the loss function in the original YOLOv5 method.
[0121] (2) All target sub-datasets are input into the YOLOv5 neural network in batches for forward propagation, and the total loss of the YOLOv5 neural network is calculated using the constructed loss function. Backward propagation is performed under the guidance of the total loss to update the weight parameter matrix and hyperparameters of the YOLOv5 neural network. After 200 epochs, the training process of the YOLOv5 neural network is completed and the YOLOv5 neural network model is obtained; among them, the hyperparameters include the learning rate and the number of iterations.
[0122] S4. Use the trained YOLOv5 neural network model to load the drone aerial images to be detected. After one forward propagation, the targets of different sizes can be located and classified, and Obj, Reg and Cls of targets of different sizes can be output. Obj represents the confidence of the predicted target, Reg represents the bounding box information of the predicted target, and Cls represents the category of the predicted target.
[0123] In order to compare the detection effect of the method described in this embodiment, this embodiment compares the original YOLOv5s method, YOLOv6s-v3.0 method, YOLOv7 method, SPD method, TPH-YOLOv5s method, Gold-YOLO method and RTDETR-1 method and the method described in this embodiment. The eight methods all adopt the same test strategy. Specifically, they are first trained for 200 epochs with the divided training set in the VisDrone dataset, and then tested with the divided test set in the VisDrone dataset. The test results are shown in Table 1. The method described in this embodiment is represented by Ours method in Table 1.
[0124] Table 1 Test results of eight target detection methods
[0125]
[0126] The evaluation indicators used in Table 1 include mAP@.5, mAP@.5:.95, F1, frame rate and model size. The evaluation indicator F1 represents the harmonic mean of accuracy and recall; mAP@.5 represents the average accuracy when IOU=0.5; mAP@.5:.95 represents the accuracy obtained by calculating an average accuracy every 0.05 from IOU 0.5 to 0.95, and then averaging all the average accuracy rates; frame rate represents the inference speed, which means how many pictures can be processed in a unit time, and the unit is frame per second (FPS); model size represents the file size of the neural network model trained by the eight methods, and the unit is mega (M), which can measure the number of model parameters. The larger the evaluation indicators F1, mAP@.5, mAP@.5:.95 and frame rate, the better, and the smaller the model size, the better.
[0127] The YOLOv5 neural network in the method described in this embodiment is improved based on the YOLOv5 neural network in the original YOLOv5 method. Moreover, as can be seen from Table 1, the three evaluation indicators of F1, mAP@.5 and mAP@.5:.95 of the original YOLOv5 method all perform better. Therefore, this embodiment focuses on comparing the test results with the original YOLOv5 method.
[0128] It can be seen from Table 1 that the evaluation indicators of the method described in this embodiment in terms of frame rate and model size are not as good as those of the original YOLOv5 method. However, the purpose of the method described in this embodiment is to improve the classification accuracy and positioning accuracy of small targets in drone aerial pictures. Moreover, it can be seen from Table 1 that the target detection method described in this embodiment is significantly better than the original YOLOv5 method in terms of the three evaluation indicators of F1, mAP@.5 and mAP@.5:.95, which indicates that the method does significantly improve the classification accuracy and positioning accuracy of small targets in drone aerial pictures compared with the original YOLOv5 method. The effects achieved by the target detection method described in this embodiment on the three evaluation indicators of F1, mAP@.5 and mAP@.5:.95 are as follows:
[0129] Compared with the original YOLOv5 method, the drone target detection method based on multi-scale fusion and dynamic perception of improved YOLOv5 described in this embodiment improves the F1 evaluation index by (0.412-0.353) / 0.353×100%=16.7%;
[0130] The drone target detection method based on multi-scale fusion and dynamic perception of improved YOLOv5 described in this embodiment improves the mAP@.5 evaluation index by (0.355-0.286) / 0.286×100%=24.1%;
[0131] The UAV target detection method based on multi-scale fusion and dynamic perception of improved YOLOv5 described in this embodiment improves the mAP@.5:.95 evaluation index by (0.199-0.153) / 0.153×100%=30.0%.
[0132] Embodiment 2
[0133] In one embodiment of the present disclosure, a drone target detection system based on multi-scale fusion and dynamic perception is provided, including:
[0134] The acquisition module is configured to: acquire an aerial picture of the drone to be detected;
[0135] The detection module is configured to: input the drone aerial image into the trained target detection model, locate and classify targets of different sizes, and obtain target detection results;
[0136] Among them, the target detection model, based on the YOLOv5s neural network, introduces a multi-scale fusion module and a dynamic perception detection head. The multi-scale fusion module is used to fuse multi-scale features, filter out useless occlusion information, and obtain an accurate target feature map. The dynamic perception detection head is used to locate and classify targets of different sizes.
[0137] Embodiment 3
[0138] The purpose of this embodiment is to provide a computer-readable storage medium.
[0139] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the method for detecting unmanned aerial vehicle targets based on multi-scale fusion and dynamic perception as described in the first embodiment of the present disclosure.
[0140] Embodiment 4
[0141] The purpose of this embodiment is to provide an electronic device.
[0142] An electronic device includes a memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, the steps in the method for detecting unmanned aerial vehicle targets based on multi-scale fusion and dynamic perception as described in the first embodiment of the present disclosure are implemented.
[0143] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A drone target detection method based on multi-scale fusion and dynamic perception, characterized in that: include: Obtain aerial images of the drone to be detected; Input the drone aerial images into the trained target detection model to locate and classify targets of different sizes and obtain target detection results; Among them, the target detection model, based on the YOLOv5s neural network, introduces a multi-scale fusion module and a dynamic perception detection head. The multi-scale fusion module is used to fuse multi-scale features, filter out useless occlusion information, and obtain an accurate target feature map. The dynamic perception detection head is used to locate and classify targets of different sizes.
2. The method for detecting unmanned aerial vehicle targets based on multi-scale fusion and dynamic perception as claimed in claim 1, characterized in that: The target detection model includes a backbone network, a neck network and a head network connected in sequence; The backbone network is used for hierarchical feature extraction; The neck network is used to filter and fuse the hierarchically extracted features to obtain a target feature map; The head network is used to locate and classify objects of different sizes using the object feature map.
3. The method for detecting unmanned aerial vehicle targets based on multi-scale fusion and dynamic perception as claimed in claim 2, characterized in that: The backbone network includes a first CBS module, a second CBS module, a first C3_1 module, a third CBS module, a second C3_1 module, a fourth CBS module, a third C3_1 module, a fifth CBS module, a fourth C3_1 module and an SPPF module which are arranged in sequence; The CBS module is used to downsample and upsample the input image; The C3_1 module is used to perform hierarchical feature extraction on the input image; The SPPF module is used to perform a pooling operation on the input image.
4. The method for detecting unmanned aerial vehicle targets based on multi-scale fusion and dynamic perception as claimed in claim 2, characterized in that: The neck network includes the sixth CBS module, the first multi-scale fusion module, the first C3_2 module, the seventh CBS module, the first multi-scale fusion module, the second C3_2 module, the eighth CBS module, the third multi-scale fusion module, the third C3_2 module, the ninth CBS module, the fourth Concat module, the fourth C3_2 module, the tenth CBS module, the fifth Concat module, the fifth C3_2 module, the eleventh CBS module, the sixth Concat module, and the sixth C3_2 module, which are arranged in sequence.
5. The method for detecting unmanned aerial vehicle targets based on multi-scale fusion and dynamic perception as claimed in claim 4, characterized in that: The multi-scale features fused by the multi-scale fusion module include a large-scale feature map, a medium-scale feature map and a small-scale feature map, which correspond to the three levels of features extracted from the backbone network respectively; The large-scale feature map of the first multi-scale fusion module comes from the third C3_1 module, the medium-scale feature map comes from the second C3_1 module, and the small-scale feature map comes from the sixth CBS module; The large-scale feature map of the second multi-scale fusion module comes from the second C3_1 module, the medium-scale feature map comes from the first C3_1 module, and the small-scale feature map comes from the seventh CBS module; The large-scale feature map of the third multi-scale fusion module comes from the first C3_1 module, the medium-scale feature map comes from the first CBS module, and the small-scale feature map comes from the eighth CBS module.
6. The method for detecting unmanned aerial vehicle targets based on multi-scale fusion and dynamic perception as claimed in claim 4, characterized in that: The head network includes a first dynamic perception detection head, a second dynamic perception detection head, a third dynamic perception detection head and a fourth dynamic perception detection head; The input ends of the first dynamic perception detection head, the second dynamic perception detection head, the third dynamic perception detection head and the fourth dynamic perception detection head are respectively connected to the output ends of the third C3_2 module, the fourth C3_2 module, the fifth C3_2 module and the sixth C3_2 module; From the fourth motion-aware detection head to the first motion-aware detection head, the objects to be located and classified gradually become smaller.
7. The method for detecting unmanned aerial vehicle targets based on multi-scale fusion and dynamic perception as claimed in claim 6, characterized in that: The dynamic perception detection head includes a convolution block, a deformable convolution module, a positioning branch and a classification branch; The convolution block is used to perform feature extraction and channel restriction on the input feature map; The deformable convolution module is used to enhance and extract the semantic information in the feature map output by the convolution block through its own unique perception ability, so as to obtain a feature map with enhanced semantic information; The positioning branch is used to extract the positioning information of the target to be detected from the feature map enhanced by semantic information; The classification branch is used to predict the category information of the target from the feature map enhanced with semantic information.
8. The UAV target detection system based on multi-scale fusion and dynamic perception is characterized by: include: The acquisition module is configured to: acquire an aerial picture of the drone to be detected; The detection module is configured to: input the drone aerial image into the trained target detection model, locate and classify targets of different sizes, and obtain target detection results; Among them, the target detection model, based on the YOLOv5s neural network, introduces a multi-scale fusion module and a dynamic perception detection head. The multi-scale fusion module is used to fuse multi-scale features, filter out useless occlusion information, and obtain an accurate target feature map. The dynamic perception detection head is used to locate and classify targets of different sizes.
9. An electronic device, comprising: a memory for non-transitory storage of computer readable instructions; a processor for executing the computer-readable instructions; Wherein, when the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 7 is executed.
10. A storage medium, characterized in that: The computer-readable instructions are non-transitorily stored, wherein when the computer-readable instructions are executed by a computer, the method of any one of claims 1 to 7 is performed.
Citation Information
Patent Citations
Pavement disease rapid detection method and system based on YOLOV7 algorithm
CN117058459A
Unmanned aerial vehicle aerial photography small target detection method based on YOLOv7 neural network
CN118015496A
Static CT pulmonary nodule detection method and system based on Yolo structure
CN118096646A
Unmanned aerial vehicle aerial photography small target detection method based on background noise weakening
CN118229965A
Cited By
Unmanned aerial vehicle target detection method based on YOLO-LiteMax neural network
CN119863725A
Method and device for detecting small target in complex environment based on unmanned aerial vehicle image
CN120032212A
Unmanned aerial vehicle water surface floating garbage detection method and system based on multi-scale dynamic feature fusion
CN120823532A
An unmanned aerial vehicle water surface floating garbage detection method and system based on multi-scale dynamic feature fusion
CN120823532B
