A method and system for all-weather detection of drone images under low-altitude and complex urban background
By combining the deep learning method with the defogging network and the fusion attention mechanism, the problem of all-weather detection of drone images under the complex urban low-altitude background is solved, and high-accuracy and high-speed drone detection is achieved, which is suitable for a variety of environments. application.
Patent Information
- Application Number
- CN202410516682.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-28
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-04-28
AI Technical Summary
All-weather detection of UAV images under low-altitude and complex urban backgrounds has small targets, complex backgrounds, low visibility in severe foggy weather, and low resolution of infrared images, which makes detection difficult. Existing technology makes it difficult to achieve 24-hour UAV detection. .
The deep learning method is used to determine whether the input image is a visible light or infrared image. The dehazing network and the detection model integrating the attention mechanism are respectively used to extract features. The category and position information of the drone is obtained through predictive structure processing, and a target frame is generated.
It achieves high-accuracy and high-speed detection of drones in the complex urban low-altitude background. The detection rate can reach 40.2 frames/second and the infrared image detection accuracy is 94.7%. It is suitable for applications in a variety of environments and fills the gap at home and abroad. research gaps.
Smart Images

Figure CN118115952B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image recognition, and in particular relates to an all-weather detection method and system for unmanned aerial vehicle images under a complex low-altitude background in a city. Background Art
[0002] As drone technology gradually shifts toward intelligence and portability, driving the rapid development of urban air traffic, people are gradually applying drone technology to smart agriculture, smart transportation, logistics delivery, and many other production and living fields, creating huge economic benefits and social value. The government has proposed to vigorously support urban drone logistics and distribution services, explore the construction of drone low-altitude logistics and distribution route networks, and expand the capacity to high-density and all-weather operations in response to the development of drones for high-density transportation in cities and long-distance needs between cities. Before 2035, active monitoring of drones will be achieved using radar, computer vision, and radio, as well as passive monitoring supplemented by visible light, infrared images, and electromagnetic wave detection.
[0003] In all-weather drone surveillance missions, visible light images are used during the day and infrared images are used at night. Under visible light conditions, there are many high-rise buildings in the city at low altitudes, and there are billboards of various colors and other urban buildings in the air. The background of drones flying at low altitudes in the city is complex and changeable, and drones are easily blocked by trees and high-rise buildings, which makes it difficult to detect drones. Compared with clear weather, drone detection tasks in foggy weather are more challenging. The heavy fog makes the visibility in the city air low, making it more difficult to accurately detect drones. Compared with drone detection under visible light image conditions, infrared images used at night have the characteristics of low resolution, weak texture features, and blurred visual effects, making it difficult to accurately predict drone detection under urban infrared image conditions, and it is difficult to detect drones in low-resolution images.
[0004] Therefore, there are several difficulties in all-weather detection of urban low-altitude drone images: first, the target is small and there is little feature information available; second, the background of the city is relatively complex, and there are more detection interference items; third, in severe foggy weather, the low visibility makes drone detection difficult; fourth, the resolution of infrared images is low, there is little feature information available, and accurate regression is difficult.
[0005] For the all-weather detection task of drone images in low-altitude and complex backgrounds in cities, few current detection models can detect drone images 24 hours a day. Through the above analysis, the problems and defects of the existing technology are as follows: in the existing all-weather detection methods of urban low-altitude drone images, there are more detection interference items, and the low visibility in the severe foggy environment makes drone detection difficult; the resolution of infrared images is low, the available feature information is small, and accurate regression is difficult; for multi-scale drone images taken from air to ground at long distances, especially drone images of small targets, it is difficult to detect drone images. Summary of the invention
[0006] In order to overcome the problems existing in the related art, the disclosed embodiments of the present invention provide an all-weather detection method and system for drone images under complex backgrounds at low altitudes in cities.
[0007] The technical solution is as follows: A method for all-weather detection of drone images under low-altitude and complex urban backgrounds, comprising:
[0008] S1, judging whether it is a visible light image or an infrared image according to the gray value of the input image;
[0009] S2, setting the initial parameters of the all-weather detection network model, inputting the training set images into the set all-weather detection network model for training, and obtaining an all-weather UAV target detection model based on deep learning;
[0010] S3, inputting the visible light image to be detected into the visible light detection model, extracting features in combination with the target detection model of the defogging network, and obtaining a feature map containing target information;
[0011] S4, input the infrared image to be detected into the infrared detection model, and obtain feature information of the low-resolution image through the infrared detection backbone network with fusion attention mechanism to obtain a feature map containing multi-layer target information;
[0012] S5, by predicting the structure and processing the feature maps of the visible light image and infrared image containing the target information, obtains the category and location information of the drone and generates the target box corresponding to each drone, and displays the drone information and confidence in the output result image.
[0013] In step S1, judging whether the input image is a visible light image or an infrared image according to the grayscale value of the input image includes: performing feature analysis on the input infrared image and the visible light image, the image features of the visible light image and the infrared image are greatly different, and the mean value of the analyzed image and the variance feature of the image are used to distinguish the image category and judge the image type;
[0014] The mean of the image is the average grayscale value of all pixels in the grayscale image, and the mean of the image reflects the brightness of the entire image; if the mean of the image is larger, the image brightness is higher; if the mean of the image is smaller, the image brightness is lower;
[0015] The variance of the image is the average of the square values of the difference between the gray value of each pixel in the image and the gray value average value of the image. The variance of the image reflects the contrast of the entire image. If the variance of the image is larger, the contrast of the image is higher; if the variance of the image is smaller, the contrast of the image is lower;
[0016] The greater the contrast of the image, the more vivid, clear and eye-catching the image is; the smaller the contrast of the image, the worse the clarity of the image; in all-weather detection, the clarity and grayscale of the image change with time;
[0017] The product of the mean of the image and the variance of the image is used as the basis for selecting different modes. If the product is greater than the threshold, it is the visible light mode, and if it is less than the threshold, it is the infrared mode. The threshold value obtained through experimental analysis is 1000.
[0018] In step S2, the all-weather detection network model includes a visible light image detection algorithm combined with a defogging network and an infrared image detection algorithm fused with an attention mechanism, which are used for daytime visible light image detection and nighttime infrared image detection, respectively, and specifically include:
[0019] According to the feature analysis of the image, it is determined whether it is a visible light image or an infrared image. For visible light images, a visible light detection model is selected, and for infrared images, an infrared image detection model is selected.
[0020] The visible light image is input into the dehazing network for training. The dehazing network divides the entire image into grids and performs local dehazing processing on each grid. This local processing method removes haze and retains the details of the image. The dehazing network is trained by learning haze and clear images, and generates a dehazed image based on the input haze image. The dehazed image is sent to the YOLOv7 detection model to extract features from the image, and finally locate it, and output an image containing the detection result information and confidence level.
[0021] For infrared images, the infrared image to be detected is input into the infrared detection model, and the SE attention mechanism is used to optimize the downsampling module, focusing on the features in the image and capturing key information, enhancing the network's ability to extract depth and important features under complex backgrounds; the spatial feature map is divided into sub-feature maps according to the proportion, and reorganized and sorted in the channel dimension, retaining all feature information in the channel dimension to avoid the loss of fine-grained information in the image; the infrared image containing object information and confidence is output;
[0022] The setting of the initial parameters of the all-weather detection network model includes: the probability of data enhancement, the use of the SGD optimizer, the momentum factor, the initial learning rate, the weight decay, the cosine annealing learning rate adjustment, the threshold during IOU training, the number of batches during training, the number of batches during testing, and the number of training iterations.
[0023] In step S3, the visible light detection model consists of a defogging model and a detection model. The defogging model implements attention-based multi-scale estimation in the backbone module. A grid structure of three rows and six columns is adopted in the backbone network. Each row corresponds to a different scale and is composed of five residual dense blocks. The number of feature maps is kept unchanged, and each column is regarded as a bridge connecting different scales by using convolution for sampling modules. In each sampling block, the size of the feature map changes with a ratio of 2, and the number of feature maps changes accordingly. Each residual dense block consists of five convolutional layers, the first four convolutional layers have a step size of 1, which is used to increase the number of feature maps, and the last convolutional layer with a step size of 2 fuses all feature maps for unified output.
[0024] In the feature fusion stage, the Transformer attention mechanism is introduced to adjust the weights of information of different scales and fuse the output of the horizontal residual dense block with the output of the vertical residual dense block. The fusion mechanism is as follows:
[0025]
[0026] In the formula, for The result after channel fusion, The first input for the current fusion level The fusion weight of each channel, The first input for the current fusion level channels, The first vertical input of the current fusion The fusion weight of the channel, The first vertical input of the current fusion channels.
[0027] In step S3, the target detection model adopts the YOLOv7 network model, which consists of four modules: input end, backbone network, neck and head. The input image is uniformly scaled and features are extracted, and multi-layer feature information is fused;
[0028] In the YOLOv7 network model, an image to be detected of any size is input, and the image is scaled to a uniform size of 640×640 pixels and input into the backbone network; the backbone network consists of batch normalization convolution BConv, efficient aggregation network ELAN and maximum pooling batch normalization convolution MPConv, which are used to extract different feature information, among which BConv consists of convolution layer, batch normalization layer and activation function, ELAN realizes network learning and convergence by controlling the shortest or longest gradient path, and MPconv contains pooling layer and convolution layer; the neck is added with spatial pyramid pooling module SPPCSPC and upsampling module UPSample that integrate cross-stage local network, and the SPPCSPC module adds multiple pooling operations in the convolution; the head adopts three detection heads, large, medium and small, to decouple the neck information, adjust the number of channels for the output features of different sizes through the RepConv module, generate bounding boxes and predict the type and confidence of the target.
[0029] Furthermore, the MPconv module in the YOLOv7 network model improves the detection network by integrating the SE attention mechanism into the backbone network to form an MPConv-SE module, performing feature extraction in the channel dimension, and adding a space-depth conversion SPD-Conv module to the small target detection head;
[0030] The MPConv-SE module embeds global information into the feature map obtained by convolution, compresses all spatial feature codes on a channel into a global feature, and uses global average pooling to obtain the channel-level global feature, which is expressed as:
[0031]
[0032] In the formula, To use channel average pooling, The feature map No. elements, are the height and width of the feature map, respectively. The feature map No. The length of the element, is the width;
[0033] The obtained weights of different channels are multiplied by the original feature map to output the features. Different weights are assigned to different positions of the input image in the channel dimension through the weight matrix to achieve adaptive recalibration. The expression is:
[0034]
[0035] In the formula, For the feature map Width Perform adaptive recalibration, is the sigmoid function, is the activation function, is the first linear layer, is the second linear layer.
[0036] Furthermore, the space-depth conversion SPD-Conv module is added to the small target detection head, including: in the space-depth layer, the input feature map Size When the scale factor is 2, the original feature map is converted to Divide into 4 sub-feature maps with feature identification information, the size is: ; Connect the sub-feature maps along the channel dimension to obtain a size of Feature Map ; Connect the non-strided convolutional layer with stride=1. The non-strided convolutional layer has filters, where The feature map To convert, the specific calculation formula is:
[0037]
[0038] In the formula, is the independent variable, and its value range is a natural number greater than or equal to 1; is the feature map, is the feature map size.
[0039] In step S5, the feature map of the visible light image and the infrared image containing the target information is processed by predicting the structure, including: pre-testing a plurality of drone targets of different sizes by using the non-maximum suppression method to find the local optimal solution; grouping all rectangular boxes according to different category labels, sorting them by scores within the group, and putting the rectangular box with the highest score into the result sequence first; traversing the remaining rectangular boxes, calculating the intersection-over-union ratio with the current rectangular box with the highest score, and removing it if it is greater than a preset threshold; then repeating the above operation for the remaining detection boxes until all candidate boxes in the image are processed to obtain the final box sequence information; generating multiple candidate boxes for an input image, calculating the intersection-over-union ratio by IOU, and obtaining the overlap degree of the real bounding box and the predicted bounding box, the expression is:
[0040]
[0041] In the formula, represents the real frame, represents the prediction box, Represents the union area of the real box and the predicted box, Represents the intersection area between the true box and the predicted box.
[0042] Furthermore, the evaluation prediction of the output results adopts the average accuracy , precision and recall The model predicts the speed in frames per second.
[0043] It refers to the average accuracy of all categories, and the calculation formula is:
[0044]
[0045] In the formula, is the number of all categories, The first The area of the Recall and the corresponding Precision curve. The average accuracy is mAP50, which refers to the predicted value AP when the intersection-over-intersection ratio threshold of the predicted box and the true value box is 0.5; The value refers to the probability of predicting that all samples are positive samples. The value refers to the probability of being correctly predicted by the model in the actual positive sample, and the calculation formula is:
[0046]
[0047]
[0048] In the formula, is the number of correctly detected targets, is the number of detection errors, Refers to the number of correct targets that were missed;
[0049] The refresh rate reflects the model reasoning speed. The calculation formula is:
[0050]
[0051] In the formula, Represents the inference time of the model for predicting a single input image.
[0052] Another object of the present invention is to provide an all-weather detection system for drone images under a low-altitude and complex urban background, which is used to control an all-weather detection method for drone images under a low-altitude and complex urban background. The system comprises:
[0053] An image judgment module is used to judge whether it is a visible light image or an infrared image according to the gray value of the input image;
[0054] The all-weather UAV target detection model construction module is used to set the initial parameters of the all-weather detection network model, input the training set images into the set all-weather detection network model for training, and obtain the all-weather UAV target detection model based on deep learning;
[0055] The feature extraction module is used to input the visible light drone image to be detected into the visible light detection model, extract features in combination with the target detection model of the defogging network, and obtain a feature map containing target information; input the infrared drone image to be detected into the infrared detection model, obtain feature information of the low-resolution image through the infrared detection backbone network with the fusion attention mechanism, and obtain a feature map containing multi-layer target information;
[0056] The all-weather detection module for drone images is used to process the feature maps of visible light and infrared images containing drone information through predictive structure, obtain the category and location information of the drone respectively, generate the target box corresponding to each drone, and display the drone information and confidence in the output result image.
[0057] In combination with all the above technical solutions, the advantages and positive effects of the present invention are as follows: the present invention adopts different urban drone detection algorithms based on the different characteristics of visible light and infrared detection in all-weather detection in low-altitude complex urban environments. First, it is judged whether it is a visible light image or an infrared image according to the grayscale value of the input image; the initial parameters of the all-weather detection network model are set, and the training set image is input into the set all-weather detection network model for training to obtain an all-weather drone target detection model based on deep learning; the visible light drone image to be detected is input into the visible light detection model, and features are extracted through the target detection model combined with the defogging network to obtain a feature map containing target information; the infrared drone image to be detected is input into the infrared detection model, and more feature information is obtained from the low-resolution image through the infrared detection backbone network fused with the attention mechanism to obtain a feature map containing multi-layer target information; the feature maps of visible light and infrared images containing drone information are processed by predicting the structure, and the category and location information of the drone are obtained respectively, and the target frame corresponding to each drone is generated, so that the drone information and confidence are directly displayed in the image. The invention has good adaptability and detection performance for both visible light and infrared image drone detection, with a visible light detection rate of up to 96.3%, a fast detection rate of 40.2 frames per second, and an infrared image detection accuracy of 94.7%, with a detection rate of 28.6 frames per second. The invention is easy to deploy on hardware devices, and the model operation is simple and easy to train.
[0058] The present invention is aimed at the all-weather detection task of UAVs under the complex background of low altitude in the city. In view of the characteristics of different images and the difficulties of actual detection at this stage, when the detection accuracy of foggy weather under visible light conditions is not high, the present invention proposes a visible light detection algorithm combined with a defogging network, which can ensure the output of undistorted images on the basis of achieving defogging, and effectively input the detection network for UAV detection. In view of the characteristics of infrared images such as low resolution, unclear target contours, and complex image background, it is difficult to effectively obtain feature information. The present invention proposes an infrared detection algorithm for obtaining multi-feature information, constructs an MPConv-SE module that integrates the attention mechanism, ensures that more feature information is obtained before image sampling, adds an SPD-Conv module at the small target detection head, optimizes the strided convolution and pooling layers, obtains more effective information of low-resolution image targets, and improves the detection effect of low-resolution small targets. A large number of experiments on visible light and infrared UAV target data sets have verified the effectiveness of the method of the present invention.
[0059] Compared with the prior art, the overall model of the present invention has good performance in detecting visible light and infrared image drone targets in complex backgrounds at low altitudes in cities. The present invention proposes a detection method for visible light drone targets in cities at daytime. The model has fast detection speed and high accuracy, achieving a detection speed of 40.2 frames per second and an accuracy of 96.3%. The present invention proposes a detection method for infrared drone targets in cities at night. The model has fast detection speed and high accuracy, achieving a detection speed of 28.6 frames per second and an accuracy of 94.7%. It can fully realize real-time detection of important places, monitor the dynamics of urban air traffic in real time and ensure the safety of the city.
[0060] The overall model of the present invention is suitable for application and deployment in a variety of different environments. The data set used by the all-weather detection method of drone images under complex backgrounds at low altitudes in cities of the present invention contains visible light and infrared drone targets from different perspectives, different scenes and different distances, which can realize all-weather monitoring of drone targets. Therefore, it has better adaptability to targets in complex environments and better expands the scope of application.
[0061] The present invention provides all-weather detection services for urban drone images; provides deployment applications; and provides applications for urban air traffic management departments to ensure drone flight safety. The present invention fills the gap in the application research of all-weather detection of drone images in urban low-altitude complex backgrounds at home and abroad; uses a defogging network combined with a target detection network to solve drone detection in severe foggy conditions; uses the SE attention mechanism to improve the detection accuracy of the deep model; and uses the SPD-Conv structure to improve the accuracy of detecting small target drones in low-resolution infrared images.
[0062] The present invention solves the problem of all-weather drone real-time detection in the low-altitude urban background, where the detection accuracy is low in foggy days with poor visible light conditions, and low-resolution images under infrared conditions make it difficult to obtain more effective target information. The present invention combines a defogging network to detect drone targets in bad foggy days, combines an SE attention mechanism module under infrared conditions, and adds an SPD-Conv convolutional structure, which greatly improves the accuracy of the drone target detection model. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] The accompanying drawings herein are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description, serve to explain the principles of the present disclosure;
[0064] Figure 1 It is a flow chart of an all-weather detection method for drone images under a low-altitude and complex urban background provided by an embodiment of the present invention;
[0065] Figure 2 It is a schematic diagram of an all-weather detection method for drone images under a low-altitude and complex urban background provided by an embodiment of the present invention;
[0066] Figure 3 is a schematic diagram of an all-weather detection model provided by an embodiment of the present invention;
[0067] Figure 4 is a schematic diagram of a visible light defogging model provided by an embodiment of the present invention;
[0068] Figure 5 is a schematic diagram of a residual dense block in a visible light dehazing model provided by an embodiment of the present invention;
[0069] Figure 6 is a schematic diagram of an infrared image detection model provided by an embodiment of the present invention;
[0070] Figure 7 is a schematic diagram of the SE attention mechanism provided by an embodiment of the present invention;
[0071] Figure 8 is a schematic diagram of a space-depth conversion module provided by an embodiment of the present invention;
[0072] Fig. 9 is a comparison diagram of PR curves under visible light conditions provided by an embodiment of the present invention;
[0073] Fig.10 is a comparison chart of F1-score curves of different models provided in an embodiment of the present invention;
[0074] Fig.11 is a comparison diagram of PR curves under infrared conditions provided by an embodiment of the present invention;
[0075] Fig.12It is a comparison diagram of F1-score curves of different models under infrared conditions provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0076] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention, so the present invention is not limited by the specific implementation disclosed below.
[0077] The innovation of the present invention is that the present invention uses computer vision methods to achieve passive and non-cooperative target monitoring of low-altitude UAV targets in cities. The present invention can automatically determine whether the input image is a visible light image or an infrared image, and input it into different models for all-weather 24-hour detection based on the result. Under visible light conditions, a detection method under severe foggy weather conditions is realized; under infrared conditions, in order to address the problem of low detection accuracy of small target UAVs in low-resolution images, the present invention combines the attention mechanism and the space-depth conversion module to improve the detection accuracy under infrared conditions, and realizes 24-hour all-weather detection of low-altitude UAV targets in cities.
[0078] Examples, such as Figure 1 As shown, the all-weather detection method for drone images under a low-altitude and complex urban background provided by an embodiment of the present invention includes the following steps:
[0079] S1, judging whether it is a visible light image or an infrared image according to the gray value of the input image;
[0080] S2, setting the initial parameters of the all-weather detection network model, inputting the training set images into the set all-weather detection network model for training, and obtaining an all-weather UAV target detection model based on deep learning;
[0081] S3, inputting the visible light image to be detected into the visible light detection model, extracting features in combination with the target detection model of the defogging network, and obtaining a feature map containing target information;
[0082] S4, input the infrared image to be detected into the infrared detection model, and obtain feature information of the low-resolution image through the infrared detection backbone network with fusion attention mechanism to obtain a feature map containing multi-layer target information;
[0083] S5, by predicting the structure and processing the feature maps of the visible light image and infrared image containing the target information, obtains the category and location information of the drone and generates the target box corresponding to each drone, and displays the drone information and confidence in the output result image.
[0084] In step S1, the embodiment of the present invention converts the input RGB three-channel image into a grayscale image, calculates the product of the average grayscale value and the variance of the grayscale image, sets a threshold for comparison, and determines whether the input image is a visible light image or an infrared image. If the average grayscale value of the image is larger, the image brightness is higher; if the average grayscale value of the image is smaller, the image brightness is lower. The variance of the image can reflect the contrast of the entire video image. If the variance of the image is larger, the contrast of the video image is higher. If the variance of the video image is smaller, the contrast of the video image is lower. These two indicators are used to measure whether the input image is a visible light image or an infrared image, and different detection models in the all-weather model are selected according to the characteristics of the image.
[0085] In step S2, the all-weather detection model provided by the embodiment of the present invention includes two algorithms, such as Figure 3 As shown in the figure, they are respectively applied to daytime visible light image detection and nighttime infrared image detection. The daytime algorithm is used to solve the problem of low detection accuracy in foggy days, and the nighttime algorithm is used to solve the problem of low resolution of infrared images. The overall process of the model is: first input the picture, select the appropriate model for detection, positioning and classification according to the different characteristics of the picture, and finally output the picture containing the detection result information and confidence. The initial parameters of the model are set including: the probability of data enhancement, the use of SGD optimizer, momentum factor, initial learning rate, weight decay, cosine annealing to adjust the learning rate, IOU (Intersection Over Union, IOU) threshold during training, the number of batches during training, the number of batches during testing, and the number of training iterations.
[0086] In step S3, the visible light detection model provided by the embodiment of the present invention is composed of two parts: a defogging model and a detection model. Figure 4 As shown in the figure, the dehazing model implements an attention-based multi-scale estimation in the backbone module. It does not rely on the traditional atmospheric scattering model and can provide more flexible and targeted image dehazing to ensure that the image is not distorted before and after input and output. The backbone network adopts a grid structure of three rows and six columns. Each row corresponds to a different scale and consists of five residual dense blocks. The number of feature maps remains unchanged. Each column can be regarded as a bridge connecting different scales by using convolution for sampling modules. Figure 5 As shown in the figure, in each sampling block, the size of the feature map changes with a ratio of 2, and the number of feature maps also changes accordingly. Each residual dense block consists of five convolutional layers, the first four convolutional layers have a stride of 1 to increase the number of feature maps, and the last convolutional layer with a stride of 2 fuses all feature maps for unified output.
[0087] In the feature fusion stage, the Transformer attention mechanism is introduced to adjust the weights of information of different scales and fuse the output of the horizontal residual dense block with the output of the vertical residual dense block. The fusion mechanism is shown in formula (1):
[0088] (1)
[0089] In the formula, for The result after channel fusion, The first input for the current fusion level The fusion weight of each channel, The first input for the current fusion level channels, The first vertical input of the current fusion The fusion weight of the channel, The first vertical input of the current fusion channels.
[0090] In step S3, the target detection model provided by the embodiment of the present invention is composed of four modules: input end, backbone network, neck, and head. The input image is uniformly scaled and features are extracted, and multi-layer feature information is fused. The YOLOv7 (You Only Look Once, YOLO) model structure mainly includes four parts: input layer, backbone network, neck, and head. An image to be detected of any size is input, and the image is scaled to a uniform size of 640×640 pixels and input into the backbone network. The backbone network is composed of BConv, efficient aggregation network ELAN and MPConv, which enhances the learning ability of the network and extracts different feature information. BConv is composed of convolution layer, batch normalization layer and activation function. ELAN realizes network learning and convergence by controlling the shortest or longest gradient path. MPconv contains pooling layer and convolution layer, which can effectively reduce the size of feature map. The neck is added with the spatial pyramid pooling module SPPCSPC and the upsampling module UPSample that integrate the cross-stage local network. The SPPCSPC module adds multiple pooling operations in the convolution to increase the receptive field, so that the algorithm can adapt to images of different resolutions and optimize and extract more feature information through the residual edge. The detection head uses three large, medium and small detection heads to decouple the neck information, adjust the number of channels for the output features of different sizes through the RepConv module, and finally generate a bounding box and predict the type and confidence of the target.
[0091] In step S4, the embodiment of the present invention improves the detection network based on the MPconv module in the YOLOv7 network model, and integrates the SE (Squeeze and Excitation, SE) attention mechanism in the backbone network to form an MPConv-SE module, which performs more effective feature extraction in the channel dimension, so that more feature information can be obtained before reducing the image dimension. Strengthen the extraction of effective information of small target drones in the backbone network, and add a space-depth conversion SPD-Conv module to the small target detection head. This module can better solve the problem that low-resolution images are unclear and it is difficult to extract effective feature information due to excessive noise. The improved network model is as follows Figure 6 As shown in the figure, the detection accuracy is improved while meeting the requirements of real-time detection, and it can be better applied to the problem of drone detection in urban low-altitude infrared images with complex backgrounds.
[0092] like Figure 7 As shown, the SE module first performs global information embedding on the feature map obtained by convolution as shown in formula (2), compresses all spatial feature codes on a channel into a global feature, and uses global average pooling to obtain channel-level global features. Then, on this basis, adaptive recalibration is performed as shown in formula (3), and the weights of different channels obtained are multiplied by the original feature map to output features. Through such a weight matrix, different weights are given to different positions of the input image in the channel dimension to measure the importance of the channel and solve the loss problem caused by the different importance of each channel in downsampling.
[0093] (2)
[0094] In the formula, To use channel average pooling, The feature map No. elements, are the height and width of the feature map, respectively. The feature map No. The length of the element, is the width;
[0095] The obtained weights of different channels are multiplied by the original feature map to output the features. Different weights are assigned to different positions of the input image in the channel dimension through the weight matrix to achieve adaptive recalibration.
[0096] (3)
[0097] In the formula, For the feature map Width Perform adaptive recalibration, is the sigmoid function, is the activation function, is the first linear layer, is the second linear layer.
[0098] In the embodiment of the present invention, a space-to-depth conversion module SPD-Conv (Space-to-depth layer and non-strided Convolution layer, SPD-Conv) is added before the small target detection head. Figure 8 As shown in Figure 2, the strided convolution and pooling layers are optimized to obtain more effective information from low-resolution images. In the spatial-depth layer, the input feature map Size When the scale factor is 2, the original feature map is converted to Divided into 4 sub-feature maps with feature identification information, the size is ; Then the sub-feature maps are connected along the channel dimension to obtain a size of Feature Map , the way of connecting sub-feature maps along the channel dimension can retain all the information of the channel dimension and avoid excessive feature information loss. Finally, a non-strided convolution layer (i.e. stride=1) is connected. Unlike the strided convolution, the non-strided convolution does not move on the feature map, but performs a convolution operation on each pixel feature map, which helps to reduce the over-sampling problem that may occur in the SPD layer and retain more fine-grained information. The non-strided convolution layer has filters, where Further, the feature map The conversion can be performed so that as much discriminative feature information as possible can be retained to facilitate the detection task. The specific calculation is shown in formula (4);
[0099] (4)
[0100] In the formula, is the independent variable, and its value range is a natural number greater than or equal to 1; is the feature map, is the feature map size.
[0101] In step S5, the method used by the embodiment of the present invention to pre-test multiple drone targets of different sizes is a non-maximum suppression method, generating multiple candidate boxes for an input image, and calculating the intersection-over-union ratio by IOU, that is, the degree of overlap between the real bounding box and the predicted bounding box. The calculation formula is shown in formula (5):
[0102] (5)
[0103] In the formula, represents the real frame, represents the prediction box, Represents the union area of the real box and the predicted box, Represents the intersection area between the true box and the predicted box.
[0104] The embodiment of the present invention uses average accuracy (mAP), precision (Precision), recall (Recall), and model prediction speed in frames per second (fps) when evaluating the prediction results. mAP refers to the average accuracy of all categories, and the calculation formula is shown in formula (6). mAP50 refers to the predicted value AP when the intersection-over-union ratio threshold of the prediction box and the true value box is 0.5. The larger the value, the better the overall detection performance of the model. The average accuracy of the present invention is mAP50. The P value refers to the probability of predicting that all samples are positive samples, and the calculation formula is shown in formula (7). The R value refers to the probability of being correctly predicted by the model in the actual positive sample, and the calculation formula is shown in formula (8). fps reflects the refresh rate of the model reasoning speed, and the calculation formula is shown in formula (9);
[0105] (6)
[0106] In the formula, is the number of all categories, The first The area of the Recall and the corresponding Precision curve. The average accuracy is mAP50, which refers to the predicted value AP when the intersection-over-intersection ratio threshold of the predicted box and the true value box is 0.5; The value refers to the probability of predicting that all samples are positive samples. The value refers to the probability of being correctly predicted by the model in the actual positive sample, and the calculation formula is:
[0107] (7)
[0108] (8)
[0109] In the formula, is the number of correctly detected targets, is the number of detection errors, Refers to the number of correct targets that were missed;
[0110] The refresh rate reflects the model reasoning speed. The calculation formula is:
[0111] (9)
[0112] In the formula, Represents the inference time of the model for predicting a single input image.
[0113] The all-weather detection system for drone images under low-altitude and complex urban backgrounds provided by the embodiment of the present invention includes:
[0114] An image judgment module is used to judge whether it is a visible light image or an infrared image according to the gray value of the input image;
[0115] The all-weather UAV target detection model construction module is used to set the initial parameters of the all-weather detection network model, input the training set images into the set all-weather detection network model for training, and obtain the all-weather UAV target detection model based on deep learning;
[0116] The feature extraction module is used to input the visible light image to be detected into the visible light detection model, extract features through the target detection model combined with the defogging network, and obtain a feature map containing target information; input the infrared image to be detected into the infrared detection model, obtain feature information of the low-resolution image through the infrared detection backbone network integrated with the attention mechanism, and obtain a feature map containing multi-layer target information;
[0117] The all-weather detection module for drone images is used to process the feature maps of visible light and infrared images containing drone information through predictive structure, obtain the category and location information of the drone respectively, generate the target box corresponding to each drone, and display the drone information and confidence in the output result image.
[0118] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0119] Since the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present invention, their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0120] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated in one processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment.
[0121] According to an embodiment of the present application, the present invention also provides a computer device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor implements the steps in any of the above-mentioned method embodiments when executing the computer program.
[0122] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0123] An embodiment of the present invention further provides an information data processing terminal, which, when executed on an electronic device, provides a user input interface to implement the steps in the above method embodiments. The information data processing terminal is not limited to mobile phones, computers, and switches.
[0124] An embodiment of the present invention further provides a server, which is used to provide a user input interface to implement the steps in the above method embodiments when executed on an electronic device.
[0125] An embodiment of the present invention further provides a computer program product. When the computer program product is run on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0126] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera device / terminal device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a disk or an optical disk.
[0127] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0128] To further demonstrate the positive effects of the above-mentioned embodiments, the present invention conducts the following experiments based on the above-mentioned technical solutions: the all-weather detection method for drones in a low-altitude urban complex background provided by the embodiment of the present invention first determines whether the input image is a visible light image or an infrared image according to the grayscale value of the input image; sets the initial parameters of the all-weather detection network model, inputs the training set image into the set all-weather detection network model for training, and obtains an all-weather drone target detection model based on deep learning; inputs the visible light drone image to be detected into the visible light detection model, extracts features through the target detection model combined with the defogging network, and obtains a feature map containing target information; inputs the infrared drone image to be detected into the infrared detection model, obtains more feature information for the low-resolution image through the infrared detection backbone network with the fusion attention mechanism, and obtains a feature map containing multi-layer target information; and processes the feature maps of the visible light and infrared images containing drone information through the predictive structure to obtain the category and location information of the drone respectively, and generates a target frame corresponding to each drone, so as to directly display the drone information and confidence in the image.
[0129] The present invention has good adaptability and detection performance for both visible light and infrared image drone detection, fast detection rate, small model size, and easy deployment on hardware equipment; the model is simple to operate and easy to train. The results compared with other existing methods under visible light conditions are shown in Table 1. The performance comparison results of existing methods under visible light conditions are shown in Table 1. The detection rate is 40.2 frames per second. The results compared with other existing methods under infrared conditions are shown in Table 2. The performance comparison results of existing methods under infrared conditions are shown in Table 2. The detection rate is 28.6 frames per second. In terms of average accuracy, precision, and recall, the present invention has the best effect.
[0130] Table 1
[0131]
[0132] Table 2
[0133]
[0134] In order to further prove the effectiveness of our model in detecting drones in foggy weather under complex low-altitude urban backgrounds, we conducted a comparative experimental analysis of our model with the advanced models of the YOLO series. Fig. 9 As shown in the figure, it is a comparison of PR curves under visible light conditions, which reflects the relationship between precision P and recall rate R. The curve area enclosed by P and R represents the accuracy of detection. Compared with other methods, our method has the highest accuracy and the best model performance. Fig.10 The following is a comparison of the F1-score curves of different models under visible light conditions. The horizontal axis is confidence and the vertical axis is F1. The closer to 1, the better the performance. The F1-score of our method is 0.95. Compared with other models, the top of the curve is closest to 1, indicating that our model can achieve a more balanced performance in drone detection tasks.
[0135] Fig.11 This is a comparison chart of PR curves under infrared conditions. Compared with other methods, our method has the highest accuracy and the best model performance. Fig.12 This is a comparison chart of the F1-score curves of different models under infrared conditions. The horizontal axis is confidence and the vertical axis is F1. The closer to 1, the better the performance. The F1-score of our method is 0.93. Compared with other models, the top of the curve is closest to 1, indicating that our model can achieve a more balanced performance in drone detection tasks.
[0136] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any modifications, equivalent substitutions and improvements made by any technician familiar with the technical field within the technical scope disclosed by the present invention and within the spirit and principles of the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for all-weather detection of drone images under low-altitude and complex backgrounds in cities, characterized in that: The method includes: S1, judging whether it is a visible light image or an infrared image according to the gray value of the input image; using the mean and variance features of the image to identify the image category and judge the image type, taking the product of the mean and variance of the image as the basis for selecting different modes, if the product is greater than the threshold, it is a visible light mode, and if it is less than the threshold, it is an infrared mode; S2, set the initial parameters of the all-weather detection network model, input the training set images into the set all-weather detection network model for training, and obtain an all-weather UAV target detection model based on deep learning. The all-weather detection network model includes two algorithms, which are respectively applied to visible light image detection during the day and infrared image detection at night; S3, inputting the visible light image to be detected into the visible light detection model, extracting features in combination with the target detection model of the defogging network, and obtaining a feature map containing target information; S4, input the infrared image to be detected into the infrared detection model, and obtain feature information of the low-resolution image through the infrared detection backbone network with fusion attention mechanism to obtain a feature map containing multi-layer target information; S5, processing the feature maps of the visible light image and the infrared image containing the target information through the prediction structure, respectively obtaining the category and location information of the drone and generating the target frame corresponding to each drone, and displaying the drone information and confidence in the output result image; In step S3, the visible light detection model consists of a defogging model and a detection model. The defogging model implements attention-based multi-scale estimation in the backbone module. A grid structure of three rows and six columns is adopted in the backbone network. Each row corresponds to a different scale and is composed of five residual dense blocks. The number of feature maps is kept unchanged, and each column is regarded as a bridge connecting different scales by using convolution for sampling modules. In each sampling block, the size of the feature map changes with a ratio of 2, and the number of feature maps changes accordingly. Each residual dense block consists of five convolutional layers, the first four convolutional layers have a step size of 1, which is used to increase the number of feature maps, and the last convolutional layer with a step size of 2 fuses all feature maps for unified output. In the feature fusion stage, the Transformer attention mechanism is introduced to adjust the weights of information of different scales and fuse the output of the horizontal residual dense block with the output of the vertical residual dense block. The fusion mechanism is as follows: In the formula, is the result of channel fusion, is the fusion weight of the i-th channel input at the current fusion level, is the i-th channel of the current fusion level input, is the fusion weight of the i-th channel of the current fused vertical input, is the i-th channel of the current fused vertical input; In step S3, the target detection model adopts the YOLOv7 network model, which consists of four modules: input end, backbone network, neck and head. The input image is uniformly scaled and features are extracted, and multi-layer feature information is fused; In the YOLOv7 network model, input an image of any size to be detected, scale the image to a uniform size of 640×640 pixels and input it into the backbone network; the backbone network consists of batch normalization convolution BConv, efficient aggregation network ELAN and maximum pooling batch normalization convolution MPConv, which are used to extract different feature information, among which BConv consists of convolution layer, batch normalization layer and activation function, ELAN realizes network learning and convergence by controlling the shortest or longest gradient path, and MPconv contains pooling layer and convolution layer; the neck is added with spatial pyramid pooling module SPPCSPC and upsampling module UPSample that integrate cross-stage local network, and the SPPCSPC module adds multiple pooling operations in the convolution; the head adopts three detection heads, large, medium and small, to decouple the neck information, adjust the number of channels for the output features of different sizes through the RepConv module, generate bounding boxes and predict the type and confidence of the target; The MPconv module in the YOLOv7 network model improves the detection network by integrating the SE attention mechanism into the backbone network to form an MPConv-SE module, extracting features in the channel dimension, and adding a space-depth conversion SPD-Conv module to the small target detection head; The MPConv-SE module embeds global information into the feature map obtained by convolution, compresses all spatial feature codes on a channel into a global feature, and uses global average pooling to obtain the channel-level global feature, which is expressed as: In the formula, F sq (u c ) is the average pooling of the channel, u c is the cth element of the feature map u, H and W are the height and width of the feature map respectively, u c (i, j) is the length of the cth element of feature map u, and i and j are the width; The obtained weights of different channels are multiplied by the original feature map to output the features. Different weights are assigned to different positions of the input image in the channel dimension through the weight matrix to achieve adaptive recalibration. The expression is: F ex (z,W)=σ(W2ReLU)W1z In the formula, F ex (z, W) is the adaptive recalibration of the width W of the feature map z, σ is the sigmoid function, ReLU is the activation function, W1 is the first linear layer, and W2 is the second linear layer; The space-depth conversion SPD-Conv module is added to the small target detection head, including: in the space-depth layer, the input feature map X has a size of S×S×C1, when the scale factor scale=2, the original feature map X is divided into 4 sub-feature maps with feature identification information according to the scale of 2, and the size is: S / 2×S / 2×C1 ; Connect the sub-feature maps along the channel dimension to obtain a feature map X′ of size S / 2×S / 2×4C1; connect a non-strided convolutional layer with stride=1, and the non-strided convolutional layer has C2 filters, where C2<(scaleC1) 2 The feature map X′ is transformed, and the specific calculation formula is: f scale-1,scale-1 =X[scale-1:S:scale,scale-1:S:scale] Where scale is an independent variable whose value range is a natural number greater than or equal to 1; X is the feature map, and S is the feature map size.
2. The all-weather detection method for drone images under low-altitude and complex urban background according to claim 1 is characterized in that: In step S1, judging whether the input image is a visible light image or an infrared image according to the grayscale value of the input image includes: performing feature analysis on the input infrared image and the visible light image, and the image features of the visible light image and the infrared image are greatly different; The mean of the image is the average grayscale value of all pixels in the grayscale image, and the mean of the image reflects the brightness of the entire image; if the mean of the image is larger, the image brightness is higher; if the mean of the image is smaller, the image brightness is lower; The variance of the image is the average of the square values of the difference between the gray value of each pixel in the image and the gray value average value of the image. The variance of the image reflects the contrast of the entire image. If the variance of the image is larger, the contrast of the image is higher; if the variance of the image is smaller, the contrast of the image is lower; The greater the contrast of the image, the more vivid, clear and eye-catching the image is; the smaller the contrast of the image, the worse the clarity of the image; in all-weather detection, the clarity and grayscale of the image change with time; the threshold value obtained through experimental analysis is 1000.
3. The all-weather detection method for drone images under low-altitude and complex urban background according to claim 1 is characterized in that: In step S2, the all-weather detection network model includes a visible light image detection algorithm combined with a defogging network and an infrared image detection algorithm fused with an attention mechanism, which are used for daytime visible light image detection and nighttime infrared image detection, respectively, and specifically include: According to the feature analysis of the image, it is determined whether it is a visible light image or an infrared image. For visible light images, a visible light detection model is selected, and for infrared images, an infrared image detection model is selected. The visible light image is input into the dehazing network for training. The dehazing network divides the entire image into grids and performs local dehazing processing on each grid. This local processing method removes haze and retains the details of the image. The dehazing network is trained by learning haze and clear images, and generates a dehazed image based on the input haze image. The dehazed image is sent to the YOLOv7 detection model to extract features from the image, and finally locate it, and output an image containing the detection result information and confidence level. For infrared images, the infrared image to be detected is input into the infrared detection model, and the SE attention mechanism is used to optimize the downsampling module, focusing on the features in the image and capturing key information, enhancing the network's ability to extract depth and important features under complex backgrounds; the spatial feature map is divided into sub-feature maps according to the proportion, and reorganized and sorted in the channel dimension, retaining all feature information in the channel dimension to avoid the loss of fine-grained information in the image; the infrared image containing object information and confidence is output; The setting of the initial parameters of the all-weather detection network model includes: the probability of data enhancement, the use of the SGD optimizer, the momentum factor, the initial learning rate, the weight decay, the cosine annealing learning rate adjustment, the threshold during IOU training, the number of batches during training, the number of batches during testing, and the number of training iterations.
4. The all-weather detection method for drone images under low-altitude and complex urban background according to claim 1 is characterized in that: In step S5, the feature map of the visible light image and the infrared image containing the target information is processed by predicting the structure, including: pre-testing a plurality of drone targets of different sizes by using the non-maximum suppression method to find the local optimal solution; grouping all rectangular boxes according to different category labels, sorting them by scores within the group, and putting the rectangular box with the highest score into the result sequence first; traversing the remaining rectangular boxes, calculating the intersection-over-union ratio with the current rectangular box with the highest score, and removing it if it is greater than a preset threshold; then repeating the above operation for the remaining detection boxes until all candidate boxes in the image are processed to obtain the final box sequence information; generating multiple candidate boxes for an input image, calculating the intersection-over-union ratio by IOU, and obtaining the overlap degree of the real bounding box and the predicted bounding box, the expression is: In the formula, A represents the real box, B represents the predicted box, A∪B represents the union area of the real box and the predicted box, and A∩B represents the intersection area of the real box and the predicted box.
5. The all-weather detection method for drone images under low-altitude and complex urban background according to claim 4 is characterized in that: The evaluation and prediction of the output results are carried out in the form of average accuracy mAP, precision P and recall R, and the model prediction speed is in frames per second; mAP refers to the average accuracy of all categories, and the calculation formula is: In the formula, c is the number of all categories, AP i It is the area of the i-th Recall and the corresponding Precision curve on the PR curve. The average accuracy rate uses mAP50, which refers to the predicted value AP when the intersection-over-union ratio threshold of the predicted box and the true value box is 0.5; the P value refers to the probability of predicting that all samples are positive samples, and the R value refers to the probability of being correctly predicted by the model in the actual positive sample. The calculation formula is: Where TP refers to the number of correctly detected targets, FP is the number of detected errors, and FN refers to the number of correct targets that are missed; FPS reflects the refresh rate of the model inference speed, and the calculation formula is: Where inference represents the inference time of the model for predicting a single input image.
6. An all-weather detection system for drone images under low-altitude and complex urban backgrounds, characterized in that: The system is used to control the all-weather detection method of drone images under a low-altitude complex urban background as described in any one of claims 1 to 5, and the system comprises: An image judgment module is used to judge whether it is a visible light image or an infrared image according to the gray value of the input image; The all-weather UAV target detection model construction module is used to set the initial parameters of the all-weather detection network model, input the training set images into the set all-weather detection network model for training, and obtain the all-weather UAV target detection model based on deep learning; The feature extraction module is used to input the visible light image to be detected into the visible light detection model, extract features in combination with the target detection model of the defogging network, and obtain a feature map containing target information; input the infrared image to be detected into the infrared detection model, obtain feature information of the low-resolution image through the infrared detection backbone network with the fusion attention mechanism, and obtain a feature map containing multi-layer target information; The all-weather detection module for drone images is used to process the feature maps of visible light and infrared images containing drone information through predictive structure, obtain the category and location information of the drone respectively, generate the target box corresponding to each drone, and display the drone information and confidence in the output result image.
