A lightweight UAV image detection method based on DETR model

By introducing VisUAVBlock and Deformable Cross Encoder into the DETR model, combined with the Wasserstein distance loss function, the problem of slow convergence speed and insensitive to small targets from the perspective of the drone is solved, and the parameter quantity and calculation complexity are reduced. Improved detection performance.

CN118135436BActive Publication Date: 2024-11-01CHONGQING UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410200090.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-23
Publication Date
2024-11-01
Estimated Expiration
2044-02-23

AI Technical Summary

Technical Problem

The existing DETR image detection algorithms are slow to converge from the perspective of the drone, insensitive to small targets, and expensive to calculate, making it difficult to effectively deploy in practical application scenarios.

Method used

VisUAVBlock is used to design a lightweight VisBackbone, combining the new loss function of Deformable Cross Encoder and Wasserstein distance. Through inverted residual cascade linear attention and dynamic sampling selection mechanism, the parameter redundancy and calculation complexity are reduced, and DINO is used to remove the parameters. Noise training.

Benefits of technology

It significantly reduces the number of parameters and computational complexity of the model, improves the detection ability of small targets, shortens the model convergence time, and performs better than other models on the VisDrone2021 test set.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118135436B_ABST
    Figure CN118135436B_ABST
Patent Text Reader

Abstract

The invention discloses an image detection method under the viewing angle of a lightweight unmanned aerial vehicle based on a DETR model, and relates to the technical field of visual systems. The present invention at least comprises the following steps: step 1: after img passes through a Visbackbone composed of VisUAVBlock, an S2 feature map, an S3 feature map, an S4 feature map and an S5 feature map are obtained, and the resolutions of the S2 feature map, the S3 feature map, the S4 feature map and the S5 feature map are 1 / 4, 1 / 8, 1 / 16 and 1 / 32 respectively; step 2: only the S5 feature is fed into a Deformable Cross Encoder, and the number of layers is 1. After the features output by the Encoder are obtained, the feature map is subjected to a secondary fusion of Top‑down and Bottom‑up; step 3: finally, the output part of the Fusion module in the second fusion is concat spliced, and object queries are generated and then fed into a decoder part, a loss function is added in the process of model convergence, and a new loss function combining Inner‑IOU and Wasserstein distance is used to accelerate the convergence speed of the model, and the subsequent process is the same as that of a DETR‑like detector, and a detection head is subjected to denoising training using DINO, and finally an image detection result is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of visual systems, and in particular to an image detection method from the perspective of a lightweight unmanned aerial vehicle based on a DETR model. Background Art

[0002] With the rapid development of science and technology, image detection technology from the perspective of drones has been widely used in many fields such as military, civil, agriculture, and transportation;

[0003] From the perspective of a drone, the scale of the target objects within the field of view is relatively small due to the high altitude of the image shooting;

[0004] Complex background factors, such as various types of trees and buildings, also continue to affect the image detection effect;

[0005] Examples of traditional image detection algorithms from the perspective of drones include Fast R-CNN (Fast r-cnn), Faster R-CNN (Faster r-cnn: Towards real-time object detection with region proposal networks) and SSD (Ssd: Single shot multibox detector);

[0006] The above technologies have problems such as low recall rate, poor model accuracy, large number of model parameters and large amount of calculation. Based on the above problems, how to ensure model accuracy while improving parameter utilization and reducing calculation complexity is a very challenging research direction;

[0007] In order to further improve the image detection effect from the perspective of drones, a variety of different technologies are often combined. Among them, combining DETR with drone detection algorithms is a very forward-looking approach. This method is different from the mainstream technology of designing coarse-to-fine dual detectors and sparse convolution to predict target areas in recent years, so it has a broader research and development significance;

[0008] DETR (Detection Transformer) is an end-to-end image detection technology based on Transformer. It solves the object matching and bounding box prediction in image detection by converting the image detection task into a set prediction problem. This technology greatly simplifies the image detection process, removes the anchor proxy task and post-processing operations such as NMS, and solves the problem of threshold selection in traditional image detection. However, due to its simple use of Transformer stacking, the image detection model still has problems such as large number of parameters and calculations, slow convergence speed, and insensitivity to small targets.

[0009] Therefore, in order to address the problems of slow convergence speed, insensitivity to small targets, and high parameter and computational overhead of the existing DETR image detection algorithm from the perspective of drones, a light-parameter image detection method for drones is needed so that it can be deployed in actual application scenarios, reduce computing resources, and meet actual needs. Summary of the invention

[0010] The purpose of the present invention is to provide a lightweight image detection method from the perspective of an unmanned aerial vehicle based on a DETR model, so as to solve the problems of slow convergence speed, insensitivity to small targets, and high parameter and computational overhead of the existing DETR image detection algorithm from the perspective of an unmanned aerial vehicle.

[0011] To achieve the above object, the present invention provides the following technical solution: an image detection method from the perspective of a lightweight UAV based on a DETR model, comprising at least the following steps:

[0012] Step 1: After img passes through the Visbackbone composed of VisUAVBlock, the S2 feature map, S3 feature map, S4 feature map and S5 feature map are obtained, and the resolutions of the S2 feature map, S3 feature map, S4 feature map and S5 feature map are 1 / 4, 1 / 8, 1 / 16 and 1 / 32 respectively. ;

[0013] Step 2: Only the S5 feature is fed into the Deformable Cross Encoder with a layer number of 1. After obtaining the features output by the Encoder, the feature map is used for secondary fusion of Top-down and Bottom-up.

[0014] Step 3: Finally, concat the output part of the Fusion module in the second fusion, generate object queries and send them to the decoder part. Add a loss function in the process of model convergence, and use a new loss function that combines Inner-IOU and Wasserstein distance to speed up the convergence of the model. The subsequent process is the same as the DETR-like detector. The detection head uses DINO for denoising training to finally get the image detection result.

[0015] Furthermore, the VisBackbone is composed of VisUAVBlock, which is divided into four stages, and each stage is composed of two VisUAVBlocks.

[0016] Furthermore, the VisUAVBlock adopts a Block designed with inverted residual cascade linear attention.

[0017] Furthermore, the design process of the VisUAVBlock includes at least the following steps:

[0018] First, the input is upsampled along the channel dimension by a 1x1 convolution to avoid loss of feature information during the mapping process;

[0019] Secondly, the features are then divided by window attention in the form of a window to obtain X ij , where i represents the i-th block, j represents the order of the attention heads, 1 < j < h, and h represents the number of attention heads;

[0020] Subsequently, it is divided according to the dimension of the attention heads to obtain [Head1, Head2,..., Head i . To reduce the computational loss brought by multi-head attention, the tokens are fed into linear attention. Taking the dimensions of Q, K, and V as N x d as an example, the calculation process of linear attention can be described as follows:

[0021] Kernel(Q, K) = φ(Q)φ(K) T

[0022]

[0023] where, x **n represents taking the nth power of each element of the x vector. The query and key pass through the kernel function to facilitate us to change the calculation order of Q, K, and V;

[0024]

[0025] In this way, we have successfully reduced the computational complexity from O(N 2 d) to O(Nd 2 ), where N is much larger than d. After passing through the corresponding calculations and the layernorm layer, the features learned by each head are added to the next layer for gradual refinement to obtain richer feature projection information. After obtaining all the Head information, concat is performed, and then the feature map is projected back to the original dimension using the projection matrix.

[0026] Furthermore, the Deformable Cross Encoder uses deformable attention and reconstructs the Encoder part based on the CSwin window attention. Specifically, the deformable keys and values are divided according to the channel dimension, [c1, c2,..., c k / 2 performs self-attention in the vertical direction, [c k / 2 , c (k+1) / 2 ,..., c k] Perform horizontal self-attention, where the vertical window height is set to the feature map height and the horizontal window width is set to the feature map width.

[0027] Furthermore, the loss function introduces Wasserstein distance to reconstruct the Boundingbox loss function of DETR;

[0028] Assume that the predicted box and groundtruth box are Pred=(cx p ,cy p ,w p ,h p ) and Gt=(cx g ,cy g ,w g ,h g ), when both are modeled as Gaussian distributions, the distance can be defined as follows:

[0029]

[0030] Use exponential function for normalization:

[0031]

[0032] where λ emd is a hyperparameter related to the dataset, and the loss function can finally be expressed as:

[0033]

[0034] L iou =λ ratio L inner +(1-λ ratio )E loss

[0035] where λ L1 ,λ iou In line with DETR, b i represents the groundtruth box, represents the prediction box, L inner represents the inner-box loss, λ ratio Is a constant.

[0036] Compared with the prior art, the present invention has the following beneficial effects:

[0037] 1. The present invention designs a cascaded linear attention block VisUAVBlock based on the inverted residual architecture and applies it to the backbone network of the model, which effectively reduces parameter redundancy while maintaining high accuracy.

[0038] 2. The present invention designs a loss function, which uses a new loss function combining Inner-IOU and Wasserstein distance to accelerate the convergence speed of the model.

[0039] 3. The present invention uses a dynamic sampling selection mechanism to reconstruct the Encoder, and uses cross-channel strip attention to expand the receptive field, alleviating the problem of attention map dispersion caused by using self-attention, while slightly reducing the number of parameters. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for describing the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0041] Figure 1 This is an overview diagram of the model of the present invention;

[0042] Figure 2 Schematic diagram of VisBackbone composed of VisUAVBlock of the present invention;

[0043] Figure 3 It is a specific structural diagram of VisUAVBlock of the present invention;

[0044] Figure 4 It is a partial schematic diagram of the Deformable Cross Encoder of the present invention;

[0045] Figure 5 This is a schematic diagram of the data verified on the VisDrone2021 test set of the present invention. DETAILED DESCRIPTION

[0046] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.

[0047] See also Figure 1 It can be seen from the overall model overview that a lightweight UAV image detection method based on the DETR model includes at least the following steps:

[0048] img is passed through VisUAVBlock( Figure 3 ) composed of Visbackbone( Figure 2) After that, S2 feature map, S3 feature map, S4 feature map and S5 feature map are obtained. The resolutions of S2 feature map, S3 feature map, S4 feature map and S5 feature map are 1 / 4, 1 / 8, 1 / 16 and 1 / 32 respectively.

[0049] Different from the DETR model, only the S5 feature is fed into the Deformable Cross Encoder with 1 layer. After obtaining the features output by the Encoder, the second fusion of Top-down and Bottom-up is performed by this feature map;

[0050] Finally, the output part of the Fusion module in the second fusion is concatenated by concat to generate object queries and then sent to the decoder part. During the model convergence process, a loss function is added, and a new loss function combining Inner-IOU and Wasserstein distance is used to accelerate the model convergence speed. The subsequent process is the same as that of the DETR-like detector. The detection head is trained for denoising using DINO, and finally the image detection result is obtained.

[0051] VisBackbone is composed of VisUAVBlock and is divided into 4 stages. Each stage consists of two VisUAVBlock, and the downsampling ratio is as Figure 3 shown.

[0052] VisUAVBlock is a block designed with inverted residual cascaded linear attention.

[0053] The design process of VisUAVBlock includes at least the following steps:

[0054] First, the input is dimensionally increased through a 1x1 convolution according to the channel dimension to avoid loss of feature information during the mapping process;

[0055] Secondly, window attention division of the features is performed in the form of a window to obtain X ij , where i represents the i-th block, j represents the order of the attention head, 1 < j < h, and h represents the number of attention heads;

[0056] Subsequently, it is divided according to the dimension of the attention head to obtain [Head1, Head2,..., Head i . In order to reduce the computational loss brought by multi-head attention, the tokens are fed into the linear attention. Taking the dimensions of Q, K, V as N x d as an example, the calculation process of the linear attention can be described as follows:

[0057] Kernel(Q, K) = φ(Q)φ(K) T

[0058]

[0059] Among them, x **n It represents taking the x vector bit by bit to the power of n. The query and key pass through the kernel function to facilitate us to change the calculation order of Q, K, and V.

[0060]

[0061] In this way, we successfully reduced the computational complexity from O(N 2 d) is reduced to O(Nd 2 ), where N is much larger than d. After the corresponding calculation and layernorm layer, the features learned by each head are added to the next layer for gradual refinement to obtain richer feature projection information. After obtaining all the head information, concat is performed, and then the feature map is projected back to the original dimension using the projection matrix.

[0062] See also Figure 4 , Deformable Cross Encoder uses deformable attention and reconstructs the Encoder part based on the CSwin window attention. Specifically, the deformable key and value are divided according to the channel dimension, [c1,c2,...,c k / 2 ] to perform self-attention in the vertical direction, [c k / 2 ,c (k+1) / 2 ,...,c k ] Perform horizontal self-attention, where the vertical window height is set to the feature map height and the horizontal window width is set to the feature map width.

[0063] The loss function introduces Wasserstein distance to reconstruct the Boundingbox loss function of DETR;

[0064] Assume that the predicted box and groundtruth box are Pred=(cx p ,cy p ,w p ,h p ) and Gt=(cx g ,cy g ,w g ,h g ), when both are modeled as Gaussian distributions, the distance can be defined as follows:

[0065]

[0066] Use exponential function for normalization:

[0067]

[0068] Among them, λemd is a hyperparameter related to the data set, and the loss function can be finally expressed as:

[0069]

[0070] L iou =λ ratio L inner +(1-λ ratio )E loss

[0071] where λ L1 ,λ iou In line with DETR, b i represents the groundtruth box, represents the prediction box, L inner represents the inner-box loss, λ ratio Is a constant.

[0072] See also Figure 5 ,The method provided in this solution is verified on the VisDrone2021 test set. While retaining the DETR architecture, this method reduces the number of parameters and computational complexity of DETR, reducing it to the same scale of parameters as the current most advanced yolov8s model (14M), and its performance far exceeds yolov8m (25.9M), +5.7mAP@0.5, +3.7%mAP. Thanks to the design of VisUAVBlock, the algorithm complexity and parameter requirements are greatly reduced, and on the basis of applying the loss function, the convergence speed of our model is accelerated. Without using pre-trained weights, nearly 17% of the time is saved to complete convergence. This result shows that the loss function can better filter out redundant bounding boxes when detecting tiny objects, thereby accelerating model convergence. In addition, Deformbale Cross Encoder uses deformable attention and performs strip attention calculations in two directions according to the channel dimension, which greatly increases the receptive field of the feature map, allowing the model to focus on a wider range of significant areas.

[0073] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations falling within the meaning and scope of the equivalent elements of the claims be included in the invention. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.

Claims

1. A method for detecting images from a lightweight UAV perspective based on a DETR model, characterized in that: At least the following steps are included: Step 1: After img passes through VisBackbone composed of VisUAVBlock, S2 feature map, S3 feature map, S4 feature map and S5 feature map are obtained, and the resolutions of S2 feature map, S3 feature map, S4 feature map and S5 feature map are 1 / 4, 1 / 8, 1 / 16 and 1 / 32 respectively; The VisUAVBlock adopts a Block designed with inverted residual cascade linear attention; The design process of VisUAVBlock includes at least the following steps: First, the input is upscaled according to the channel dimension through a 1x1 convolution to avoid the loss of feature information during the mapping process; Next, the features are divided by window attention in the form of a window to obtain X ij , where i represents the i-th Block, j represents the order of the attention heads, 1 < j < h, and h represents the number of attention heads; Then, we divide the attention head into [Head1, Head2, ..., Head i ], in order to reduce the computational loss caused by multi-head attention, the token is fed into the linear attention. Taking the dimension of Q, K, V as N×d as an example, the calculation process of linear attention is described as follows: Kernel(Q,K)=φ(Q)φ(K) T Among them, x **n It represents taking the x vector bit by bit to the power of n. The query and key pass through the kernel function to facilitate us to change the calculation order of Q, K, and V. In this way, the computational complexity is reduced from O(N 2 d) is reduced to O(Nd 2 ), where N is much larger than d. After the corresponding calculation and layernorm layer, the features learned by each head are added to the next layer for gradual refinement to obtain richer feature projection information. After all the head information is obtained, concat is performed, and then the feature map is projected back to the original dimension using the projection matrix; Step 2: Only the S5 feature is fed into the Deformable Cross Encoder with a layer number of 1. After obtaining the features output by the Encoder, the feature map is used for secondary fusion of Top-down and Bottom-up. The Deformable Cross Encoder uses deformable attention and reconstructs the Encoder part based on the CSwin window attention. Specifically, the deformable key and value are divided according to the channel dimension, [c1,c2,...,c k / 2 ] to perform self-attention in the vertical direction, [c k / 2 ,c (k+1) / 2 ,...,c k ] Perform self-attention in the horizontal direction, where the vertical window height is set to the feature map height and the horizontal window width is set to the feature map width; Step 3: Finally, concat the output part of the Fusion module in the second fusion, generate object queries and send them to the decoder part. Add a loss function in the process of model convergence, and use a new loss function that combines Inner-IOU and Wasserstein distance to speed up the convergence of the model. The subsequent process is the same as the DETR-like detector. The detection head uses DINO for denoising training to finally get the image detection result.

2. According to claim 1, a method for detecting images from a lightweight UAV perspective based on a DETR model, characterized in that: The VisBackbone is composed of VisUAVBlock, which is divided into 4 stages, and each stage is composed of two VisUAVBlocks.

3. The image detection method based on the DETR model from the perspective of a lightweight UAV according to claim 1 is characterized in that: The loss function introduces Wasserstein distance to reconstruct the BoundingBox loss function of DETR; Assume that the predicted Box and the groundtruth Box are Pred=(cx p ,cy p ,w p ,h p ) and Gt=(cx g ,cy g ,w g ,h g ), when both are modeled as Gaussian distributions, the distance can be defined as follows: Use exponential function for normalization: where λ emd is a hyperparameter related to the dataset, and the loss function can finally be expressed as: L iou =λ ratio L inner +(1-l ratio )E loss where λ L1 ,λ iou In line with DETR, b i represents the groundtruth Box, represents the prediction box, L inner represents inner-Box loss, λ ratio Is a constant.