Lightweight unmanned aerial vehicle image drowning person detection algorithm based on YOLOv7

By replacing the backbone network with MobileNetV4 on YOLOv7, and introducing the CA attention mechanism and Wise-IoU loss function, the SPPCSPC structure is reconstructed, which solves the problem of balancing detection speed and accuracy in the UAV image falling person detection algorithm, and achieves for efficient deployment on edge devices.

CN118711090AActive Publication Date: 2024-09-27CHANGCHUN UNIV OF SCI & TECH
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410917379.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2024-09-27
Estimated Expiration
2044-07-10

AI Technical Summary

Technical Problem

Existing detection algorithms for people falling into the water in drone images are difficult to balance between detection speed and accuracy. Especially when edge devices are deployed, the computing cost is too high, which affects the demand for real-time detection.

Method used

Using a lightweight detection algorithm based on YOLOv7, by replacing the backbone network with MobileNetV4, and introducing the CA attention mechanism and Wise-IoU loss function, the SPPCSPC structure is reconstructed, the convolution parameters and pooling layer complexity are reduced, and the calculation speed is improved.

Benefits of technology

While the detection accuracy is slightly reduced, the detection speed is greatly improved, and the amount of model parameters and calculations are significantly reduced, making it more suitable for deployment on edge devices with limited computing power such as drones.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118711090A
    Figure CN118711090A
Patent Text Reader

Abstract

The invention belongs to the technical field of deep learning target detection, and particularly relates to a lightweight unmanned aerial vehicle image drowning person detection algorithm based on YOLOv7, comprising the following steps: S1, collecting a proper amount of swimming and drowning person pictures, and making a data set; s2, a YOLOv7 backbone network is replaced by a MobileNetV4 (Mobile NetV4); s3, reconstructing an SPPCSPC structure of the YOLOv7, and introducing a CA attention mechanism and a Wise-IoU loss function; s4, performing an ablation experiment on the self-made data set; and S5, comparing the improved algorithm with other target detection algorithms on the homemade data set. According to the algorithm provided by the invention, on the premise that only a small amount of detection precision is lost, the parameter quantity and the calculation quantity of an original algorithm are greatly reduced, the detection speed is greatly improved, and the original algorithm is lightened, so that the algorithm is easier to deploy on edge equipment with limited calculation power, such as an unmanned aerial vehicle.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of deep learning target detection, and specifically is a lightweight unmanned aerial vehicle image falling-into-water detection algorithm based on YOLOv7. Background Art

[0002] According to statistics from the World Health Organization, at least 236,000 people die from drowning every year around the world, and deaths caused by drowning account for 7% of all unintentional injury-related deaths worldwide. These figures are not only heartbreaking, but also reveal the reality that there is an urgent need to improve water rescue technology. In the field of water rescue, rapid and effective detection of people falling into the water is the key to improving the rescue rate. Traditional rescue methods are limited by manpower and natural conditions and cannot meet the needs of rapid response. With the development of drone technology and deep learning, drone-based target detection provides new perspectives and possibilities for rescue operations.

[0003] As one of the core tasks in the field of computer vision, target detection technology has also ushered in revolutionary changes in recent years with the rise of deep learning. At present, target detection algorithms based on deep learning are mainly divided into two categories. One is the two-stage target detection algorithm, such as R-CNN, Faster R-CNN, Mask R-CNN, SPPNet, etc. This type of algorithm has high detection accuracy, but slow detection speed. The other is the single-stage target detection algorithm, such as SSD and YOLO series. This type of algorithm has a fast detection speed, but the detection accuracy is not as good as the two-stage algorithm.

[0004] At present, for detection tasks from the perspective of drones, Zhao Hangyue et al. added a detection head to reduce the negative impact of excessive variance in target scale; Jawaharlalnehru et al. used the K-means clustering algorithm to determine the optimal anchor box size, making it more effective in detecting targets at multiple scales; Huang Shuqin et al. proposed a scale-aware weighted loss function to dynamically weight targets to enhance the contribution of small-scale targets to the loss; Willy et al. introduced SwimTransformer into DetectoRS to enhance the network's ability to capture and process global information, but the model's computational cost is too high and it is not easy to deploy in edge devices. At present, the research on detection algorithms from the perspective of drones is increasing, and the detection accuracy is also improving, but the demand for real-time detection has not been fully met.

[0005] Model deployment is an issue that must be considered in the process of algorithm research. In order to speed up the model reasoning speed, many scholars have conducted a lot of research and made considerable progress. The adaptive perceptual spatial pyramid module designed by Xiao Jin et al. speeds up the reasoning speed and reduces the number of model parameters by dynamically adjusting the parameters of the decoder. Zhou Quan et al. proposed a dual-path lightweight network, the computational complexity of which is linearly related to the input feature resolution. By processing features of different resolutions separately, a lot of computational costs can be saved. Guo Jinyang et al. proposed a multi-dimensional pruning framework that compresses the network along multiple dimensions in an end-to-end manner to improve the model operation efficiency. Although the above lightweight design simplifies the model and improves the model operation efficiency, it has a relatively large impact on the detection accuracy.

[0006] Therefore, the present invention proposes a lightweight UAV image falling-into-water detection algorithm based on YOLOv7 to solve the above problems. Summary of the invention

[0007] 1. Technical issues to be resolved

[0008] In view of the shortcomings of the prior art, the present invention provides a lightweight UAV image falling-into-water detection algorithm based on YOLOv7, which solves the problems raised in the above background technology.

[0009] (II) Technical solution

[0010] In order to achieve the above-mentioned purpose, the present invention specifically adopts the following technical solutions:

[0011] A lightweight UAV image falling-into-water detection algorithm based on YOLOv7, including the following steps:

[0012] S1. Collect a suitable amount of pictures of people swimming and falling into the water to create a data set;

[0013] S2, replace the YOLOv7 backbone network with MobileNetV4;

[0014] S3, reconstruct the SPPCSPC structure of YOLOv7, and introduce the CA attention mechanism and Wise-IoU loss function;

[0015] S4, ablation experiments were performed on self-made datasets;

[0016] S5. Compare the improved algorithm with other target detection algorithms on a self-made dataset.

[0017] Furthermore, the specific process of S1 is to collect swimming pictures and falling water pictures with appropriate height and resolution on the Internet, and try to collect pictures in different scenes and various swimming postures. After the collection is completed, the pictures are labeled using Labelme software. The data set includes two labeled categories: swimmers and people falling into the water. The scenes are mainly oceans, rivers, ponds, etc.

[0018] Furthermore, the MobileNetV4 in S2 is a new generation of lightweight detection network proposed by Qin Danfeng et al. The network introduces a universal inverted bottleneck block, which is an adjustable module suitable for efficient network design. It can adapt to various optimization objectives without increasing the complexity of network search. The module is improved from the inverted bottleneck block in MobileNetV2.

[0019] Furthermore, S3 makes the following improvements to the SPPCSPC structure by referring to the depthwise separable convolution in MobileNetV4 and the SPPELAN structure in YOLOv9:

[0020] (1) The 3*3 convolution is replaced by 3*3 depthwise convolution and 1*1 pointwise convolution, thereby significantly reducing the convolution parameters;

[0021] (2) Redesign the pooling layer structure and change the pooling window size from (5, 9, 13) to three serial structure pooling layers with a window size of 5 to improve the calculation speed;

[0022] (3) Replace the SiLU function in the initial and final 1*1 convolutional layers with the ReLU function to improve the model detection accuracy. The location and number of the ReLU function are based on experiments;

[0023] The CA attention mechanism in S3 encodes channel relationships and long-term dependencies through precise location information. The specific operation is divided into two steps a and b: Coordinate information embedding and Coordinate Attention generation.

[0024] a. Coordinate information embedding

[0025] The global pooling method is usually used for global encoding of channel attention encoding spatial information, but because it compresses the global spatial information into the channel descriptor, it is difficult to preserve the position information. In order to enable the attention module to capture long-range spatial interactions with precise position information, the global pooling is decomposed according to the following formula and converted into a one-to-one feature encoding operation:

[0026]

[0027] Specifically, given an input X, we first use a pooling kernel of size (H, 1) or (1, W) to encode each channel along the horizontal and vertical coordinates, respectively. Therefore, the output of the cth channel with height h can be expressed as:

[0028]

[0029] Similarly, the output of the cth channel with width w can be written as:

[0030]

[0031] The above two transformations aggregate features along two spatial directions respectively, and obtain a pair of direction-aware feature maps;

[0032] b. Coordinate Attention Generation

[0033] After the transformation in information embedding, this part concatenates the above transformation and then transforms it using the 1*1 convolution transformation function F1:

[0034] f=δ(F1([z h ,z w ]))

[0035] where [·,·] is the concatenation operation along the spatial dimension, δ is the nonlinear activation function, and f is the intermediate feature map that encodes the spatial information in the horizontal and vertical directions. Here, r is used to control the reduction rate of the SE block size. Then, f is decomposed into two separate tensors f along the spatial dimension. h and f w , using another two 1*1 convolution transformations F h and F w f h and f w Transformed into a tensor with the same number of channels as the input X, we get:

[0036] g h =σ(F h (f h ))

[0037] g w =σ(F w (f w ))

[0038] Here σ is the sigmoid activation function. In order to reduce the complexity and computational overhead of the model, an appropriate reduction ratio r (such as 32) is usually used to reduce the number of channels of f, and then the output g is h and g wExpand them and use them as attentionweights respectively. Finally, the output Y of the CA attention mechanism can be written as:

[0039]

[0040] The Wise-IoU loss function in S3 is defined as follows:

[0041] S u =wh+w gt h gt -W i H i

[0042]

[0043] L WIoU =R WIoU L IoU

[0044] Where W g , H g Indicates the width and height of the minimum bounding box. In order to prevent R wiou Produces gradients that hinder convergence, W g and H g Separate from the computation graph (superscript * denotes this operation).

[0045] Furthermore, in order to verify the effectiveness of the improvement of each module in S4, each module is tested separately to verify the effectiveness of the improvement. The same experimental environment is used in the experiment, and the frame rate FPS, parameter quantity Params, floating-point operation number GFLOPs, and average precision mAP are used as evaluation indicators to evaluate the effectiveness of the proposed improvement measures. The frame rate refers to the number of image refresh frames, the parameter quantity unit is M, the floating-point operation number unit is G, and the average precision mean refers to the mean of the detection accuracy of all categories. The calculation formula is as follows:

[0046]

[0047] Where TP represents the number of positive samples predicted as positive samples, FP represents the number of negative samples predicted as positive samples, FN represents the number of positive samples predicted as negative samples, c represents the total number of target detection categories, P(R) is a curve drawn with recall as X-axis and accuracy as Y-axis, and the area of ​​the figure enclosed by the curve and the coordinate axis is the average accuracy; and when reconstructing the SPPCSPC structure, the convolutional layer and pooling layer structures are improved, and comparative experiments are carried out on the model with the backbone network replaced.

[0048] Furthermore, S5 specifically demonstrates the superiority of this algorithm by comparing classic algorithms SSD, Faster R-CNN and other YOLO algorithms.

[0049] (III) Beneficial effects

[0050] Compared with the prior art, the present invention provides a lightweight UAV image falling-into-water detection algorithm based on YOLOv7, which has the following beneficial effects:

[0051] 1. The algorithm proposed in the present invention significantly improves the detection speed while slightly reducing the detection accuracy, and the number of model parameters and the amount of calculation are also greatly reduced.

[0052] 2. The present invention, by lightweighting the original algorithm, makes it easier to deploy on edge devices with limited computing power such as drones. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 This is a flowchart of a light-weight UAV image drowning person detection algorithm based on YOLOv7 according to an embodiment of the present invention;

[0054] Figure 2 This is a schematic diagram of the improved YOLOv7 algorithm structure of the present invention;

[0055] Figure 3 It is a comparison diagram between the improved SPPCSPC structure of the present invention and the original SPPPCSPC structure;

[0056] Figure 4 It is a schematic diagram of the experimental environment of the present invention;

[0057] Figure 5 It is a schematic diagram of experimental parameters of the present invention;

[0058] Figure 6 , 7 This is a graph of the experimental results of the improved SPPCSPC of the present invention;

[0059] Figure 8 This is a diagram of the ablation experiment results of the present invention;

[0060] Fig. 9 This is a comparison result diagram of the algorithm of the present invention. DETAILED DESCRIPTION

[0061] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0062] Example

[0063] like Figure 1-9 As shown, an embodiment of the present invention proposes a lightweight UAV image falling-into-water person detection algorithm based on YOLOv7, comprising the following steps:

[0064] S1. Collect a suitable amount of pictures of people swimming and falling into the water to create a data set;

[0065] We collected swimming and drowning pictures with appropriate height and resolution on the Internet, and tried to collect pictures in different scenes and various swimming postures. After the collection was completed, we used Labelme software to annotate the pictures. The dataset includes two annotated categories: swimmers and drowning people. The scenes are mainly oceans, rivers, and ponds. The dataset contains a total of 2,360 images, including 1,888 training sets, 236 validation sets, and 236 test sets.

[0066] S2, replace the YOLOv7 backbone network with MobileNetV4;

[0067] MobileNetV4 is a new generation of lightweight detection network proposed by Qin Danfeng et al. in April 2024. The network introduces a universal inverted bottleneck block, which is an adjustable module suitable for efficient network design, capable of adapting to various optimization objectives without increasing the complexity of network search. This module is improved from the inverted bottleneck block in MobileNetV2.

[0068] S3, reconstruct the SPPCSPC structure of YOLOv7, and introduce the CA attention mechanism and Wise-IoU loss function;

[0069] Ⅰ. Reconstruction of SPPCSPC structure

[0070] Although the SPPCSPC structure performs better than the SPPF structure, its parameter quantity and computational cost also increase accordingly. In order to further simplify the model and improve the model performance, the present invention decides to improve the SPPCSPC module.

[0071] By referring to the depthwise separable convolution in MobileNetV4 and the SPPELAN structure in YOLOv9, the SPPCSPC structure is improved as follows:

[0072] (1) The 3*3 convolution is replaced by a 3*3 depthwise convolution and a 1*1 point-by-point convolution, thereby significantly reducing the convolution parameters.

[0073] (2) The pooling layer structure is redesigned, and the size of the pooling window is changed from (5, 9, 13) to three serial structure pooling layers with a window size of 5 to improve the calculation speed.

[0074] (3) Replace the SiLU function in the initial and final 1*1 convolutional layers with the ReLU function to improve the model detection accuracy. The location and number of the ReLU function are based on experiments.

[0075] The improved module is called SPPDPC in the present invention. The module structure comparison diagram is shown in Figure 3 shown.

[0076] II. Introducing CA Attention Mechanism

[0077] In water, swimmers and drowning people have limited exposure area, and due to the increase in distance, some individuals may account for a smaller proportion in the image. As the number of network layers increases during detection, the details and feature information of some targets may be lost, which may affect the recognition accuracy of the network. In order to solve this problem, the present invention introduces the CA attention mechanism, which can effectively improve the detection accuracy of the network without significantly increasing the computational burden.

[0078] The CA attention mechanism encodes channel relationships and long-term dependencies through precise location information. The specific operation is divided into two steps: Coordinate information embedding and Coordinate Attention generation.

[0079] Coordinate information embedding: Global pooling is usually used for global encoding of spatial information in channel attention encoding, but it is difficult to preserve position information because it compresses global spatial information into channel descriptors. In order to enable the attention module to capture long-range spatial interactions with precise position information, the global pooling is decomposed according to the following formula and converted into a one-to-one feature encoding operation:

[0080]

[0081] Specifically, given an input X, each channel is first encoded along the horizontal and vertical coordinates using a pooling kernel of size (H, 1) or (1, W), respectively. Therefore, the output of the cth channel with height h can be expressed as:

[0082]

[0083] Similarly, the output of the cth channel with width w can be written as:

[0084]

[0085] The above two transformations aggregate features along two spatial directions respectively to obtain a pair of direction-aware feature maps.

[0086] Coordinate Attention generation: After the transformation in information embedding, this part concatenates the above transformation and then uses the 1*1 convolution transformation function F1 to transform it:

[0087] f=δ(F1([z h ,z w ]))

[0088] Where [·,·] is the concatenation operation along the spatial dimension, δ is the nonlinear activation function, and f is the intermediate feature map that encodes the spatial information in the horizontal and vertical directions. Here, r is used to control the reduction rate of the SE block size. Then f is decomposed into two separate tensors f along the spatial dimension. h and f w . Using two more 1*1 convolution transformations F h and F w f h and f w Transformed into a tensor with the same number of channels as the input X, we get:

[0089] g h =σ(F h (f h ))

[0090] g w =σ(F w (f w ))

[0091] Here σ is the sigmiod activation function. In order to reduce the complexity and computational overhead of the model, an appropriate reduction ratio r (such as 32) is usually used to reduce the number of channels of f. Then the output g h and g w Expand them and use them as attentionweights respectively.

[0092] Finally, the output Y of the CA attention mechanism can be written as:

[0093]

[0094] III. Introducing Wise-IoU loss function

[0095] In YOLOv7, C-IoU is used as the loss function, which comprehensively considers the overlapping area, center point distance and aspect ratio between the prediction boxes to calculate the regression error of the prediction box. However, since the training data inevitably contains low-quality samples, geometric factors (such as distance and aspect ratio) will increase the penalty for low-quality samples, thereby reducing the generalization performance of the model. In order to weaken the impact of geometric factors on low-quality samples, the present invention chooses to introduce Wise-IoU as the loss function of YOLOv7. The definition of Wise-IoU is as follows:

[0096] S u =wh+w gt h gt -W i H i

[0097]

[0098] L WIoU =R WIoU L IoU

[0099] Where W g , H g Indicates the width and height of the minimum bounding box. In order to prevent R wiou Produces gradients that hinder convergence, W g and H g Separate from the computation graph (superscript * denotes this operation).

[0100] S4, ablation experiments were performed on self-made datasets;

[0101] Ⅰ. Experimental Configuration and Evaluation Indicators

[0102] The experimental environment and experimental parameters are set as follows Figure 4 , Figure 5 The present invention uses average precision mAP, frame rate FPS, parameter quantity Params and floating point operation number GFLOPs as evaluation indicators to evaluate the effectiveness of the proposed improvement measures.

[0103] The mean average precision refers to the mean of the detection accuracy of all categories, and the calculation formula is as follows:

[0104]

[0105] Where TP represents the number of positive samples predicted as positive samples, FP represents the number of negative samples predicted as positive samples, FN represents the number of positive samples predicted as negative samples, c represents the total number of target detection categories, P(R) is a curve drawn with recall as the X-axis and accuracy as the Y-axis, and the area of ​​the figure enclosed by the curve and the coordinate axis is the average accuracy.

[0106] Frame rate refers to the number of image refresh frames. The unit of parameter quantity is M. The unit of floating point operation number is G.

[0107] Ⅱ. SPPC and SPC comparison experiment

[0108] When reconstructing the SPPCSPC structure, we first improved the convolutional layer and pooling layer structures, and conducted comparative experiments on the model with the backbone network replaced, such as Figure 6 From the (1) and (2) groups, we can see that the number of parameters of the improved model has dropped by 4.18M and the FPS has slightly increased, indicating that the improvement has initially shown results. However, we noticed that the accuracy of the model has decreased, so we decided to improve the accuracy of the model. We used the ReLU activation function for adjustment and experimented with the number and position of the ReLU function in the five 1*1 convolutional layers. The results are shown in Figure 7 The comparison experiments in groups (3) to (7) are shown in Figure 1. From the results, we can see that the more ReLU functions there are, the better. Overall, adding two ReLU functions has the best effect. To verify the best location to add the ReLU function, we conducted experiments at different locations. The results are shown in Figure 1. Figure 7 As shown, overall, group (4) performed the best.

[0109] III. Ablation Experiment

[0110] To prove the performance of the algorithm of the present invention, we conducted an ablation experiment under the same conditions. The experimental results are shown in Figure 8 As shown, v1 represents the original YOLOv7 model, and v6 represents the improved performance.

[0111] From the figure, we can see that after replacing the backbone network, mAP50 decreased by 1.6%, but FPS increased by 103%, and the amount of calculation and parameters decreased by 61.9% and 13.45M respectively, indicating that the model lightweight improvement is effective. In V3, the amount of calculation and parameter decreased by 8.3% and 4.18M, ​​and mAP50 increased by 0.24% while FPS remained unchanged, indicating that SPPDPC is more suitable for this network structure. In V4, mAP50 increased by 0.29%. Although FPS decreased slightly, it was within an acceptable range. In V5, mAP50 increased by 0.1% while fps remained unchanged, proving that this loss function is more suitable for this dataset. Compared with the original YOLOv7 model, the final improved model increased FPS by 97.8% while mAP only decreased by 1.08%, and the amount of parameters and calculations were reduced by 46.7% and 65.0% respectively.

[0112] Through the analysis of the above test results, it is found that the algorithm parameters and calculation amount of the present invention are significantly reduced, which better balances the detection accuracy and speed. Compared with the original model, it is more suitable for deployment on drones.

[0113] S5. Compare the improved algorithm with other target detection algorithms on a self-made dataset

[0114] In order to reflect the effectiveness of the algorithm improvement, SSD, Faster R-CNN and YOLO series target detection models were used for comparison. The self-made data set was tested under the same experimental environment configuration and parameters. The model comparison experimental results are shown in the figure below. Fig. 9 shown.

[0115] As can be seen from the figure, although the two-stage Faster R-CNN uses a regional proposal network, the model accuracy is still lower than that of the YOLO series, and the detection speed is slow, which is difficult to meet the requirements of real-time detection. In the single-stage algorithm, although SSD has a higher detection speed and can achieve real-time detection, it is not much different from the YOLO series, and the detection accuracy is too different from the YOLO series, which is difficult to meet the application requirements of complex scenes. In the YOLO series, although YOLOv7 is slightly inferior to YOLOv3 and YOLOv4 in terms of detection speed, its detection accuracy and number of parameters are better than both of them. In addition, YOLOv7 is better than YOLOv5 in all indicators. Overall, YOLOv7 better balances accuracy and speed. The mAP of the improved algorithm is only 1.08% lower than that of YOLOv7, but the detection speed is nearly doubled, and the number of parameters and the amount of calculation are greatly reduced. Compared with other algorithms, the algorithm of the present invention is more suitable for deployment on resource-constrained drone platforms.

[0116] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A lightweight UAV image falling-into-water detection algorithm based on YOLOv7, characterized in that: The following steps are involved: S1. Collect a suitable amount of pictures of people swimming and falling into the water to create a data set; S2, replace the YOLOv7 backbone network with MobileNetV4; S3, reconstruct the SPPCSPC structure of YOLOv7, and introduce the CA attention mechanism and Wise-IoU loss function; S4, ablation experiments were performed on self-made datasets; S5. Compare the improved algorithm with other target detection algorithms on a self-made dataset.

2. According to the YOLOv7-based lightweight UAV image falling-into-water detection algorithm according to claim 1, it is characterized in that: The specific process of S1 is to collect swimming pictures and falling water pictures with appropriate height and resolution on the Internet, and try to collect pictures in different scenes and various swimming postures. After the collection is completed, Labelme software is used to annotate the pictures. The data set includes two annotation categories: swimmers and people falling into the water. The scenes are mainly oceans, rivers, ponds, etc.

3. The YOLOv7-based lightweight UAV image drowning detection algorithm according to claim 1, characterized in that: The MobileNetV4 in S2 is a new generation of lightweight detection network proposed by Qin Danfeng et al. The network introduces a universal inverted bottleneck block, which is an adjustable module suitable for efficient network design. It can adapt to various optimization goals without increasing the complexity of network search. The module is improved from the inverted bottleneck block in MobileNetV2.

4. The YOLOv7-based lightweight UAV image drowning detection algorithm according to claim 1, characterized in that: In S3, the following improvements are made to the SPPCSPC structure by referring to the depth-separable convolution in MobileNetV4 and the SPPELAN structure in YOLOv9: (1) The 3*3 convolution is replaced by 3*3 depthwise convolution and 1*1 pointwise convolution, thereby significantly reducing the convolution parameters; (2) Redesign the pooling layer structure and change the pooling window size from (5, 9, 13) to three serial structure pooling layers with a window size of 5 to improve the calculation speed; (3) Replace the SiLU function in the initial and final 1*1 convolutional layers with the ReLU function to improve the model detection accuracy. The location and number of the ReLU function are based on experiments; The CA attention mechanism in S3 encodes channel relationships and long-term dependencies through precise location information. The specific operation is divided into two steps a and b: Coordinate information embedding and Coordinate Attention generation. a. Coordinate information embedding The global pooling method is usually used for global encoding of channel attention encoding spatial information, but because it compresses the global spatial information into the channel descriptor, it is difficult to preserve the position information. In order to enable the attention module to capture long-range spatial interactions with precise position information, the global pooling is decomposed according to the following formula and converted into a one-to-one feature encoding operation: Specifically, given an input X, we first use a pooling kernel of size (H, 1) or (1, W) to encode each channel along the horizontal and vertical coordinates, respectively. Therefore, the output of the cth channel with height h can be expressed as: Similarly, the output of the cth channel with width w can be written as: The above two transformations aggregate features along two spatial directions respectively, and obtain a pair of direction-aware feature maps; b. Coordinate Attention Generation After the transformation in information embedding, this part concatenates the above transformation and then transforms it using the 1*1 convolution transformation function F1: f=δ(F1([z h ,z w ])) where [·,·] is the concatenation operation along the spatial dimension, δ is the nonlinear activation function, and f is the intermediate feature map that encodes the spatial information in the horizontal and vertical directions. Here, r is used to control the reduction rate of the SE block size. Then, f is decomposed into two separate tensors f along the spatial dimension. h and f w , using another two 1*1 convolution transformations F h and F w f h and f w Transformed into a tensor with the same number of channels as the input X, we get: g h =σ(F h (f h )) g w =σ(F w (f w )) Here σ is the sigmoid activation function. In order to reduce the complexity and computational overhead of the model, an appropriate reduction ratio r (such as 32) is usually used to reduce the number of channels of f, and then the output g is h and g w Expand them and use them as attentionweights respectively. Finally, the output Y of the CA attention mechanism can be written as: The Wise-IoU loss function in S3 is defined as follows: S u =wh+w gt h gt -W i H i L WIoU =R WIoU L IoU Where W g , H g Indicates the width and height of the minimum bounding box. In order to prevent R wiou Produces gradients that hinder convergence, W g and H g Separate from the computation graph (superscript * denotes this operation).

5. The YOLOv7-based lightweight UAV image drowning detection algorithm according to claim 1, characterized in that: In order to verify the effectiveness of the improvement of each module in S4, each module is tested separately to verify the effectiveness of the improvement. The same experimental environment is used in the experiment, and the frame rate FPS, parameter quantity Params, floating-point operation number GFLOPs, and average precision mAP are used as evaluation indicators to evaluate the effectiveness of the proposed improvement measures. The frame rate refers to the number of image refresh frames, the parameter quantity unit is M, the floating-point operation number unit is G, and the average precision means refers to the mean of the detection accuracy of all categories. The calculation formula is as follows: Where TP represents the number of positive samples predicted as positive samples, FP represents the number of negative samples predicted as positive samples, FN represents the number of positive samples predicted as negative samples, c represents the total number of target detection categories, P(R) is a curve drawn with recall as X-axis and accuracy as Y-axis, and the area of ​​the figure enclosed by the curve and the coordinate axis is the average accuracy; and when reconstructing the SPPCSPC structure, the convolutional layer and pooling layer structures are improved, and comparative experiments are carried out on the model with the backbone network replaced.

6. The YOLOv7-based lightweight UAV image drowning detection algorithm according to claim 1, characterized in that: S5 specifically demonstrates the superiority of this algorithm by comparing the classic algorithms SSD, Faster R-CNN and other YOLO algorithms.

Citation Information

Patent Citations

  • Lightweight YOLOv4 pedestrian detection method under view angle of unmanned aerial vehicle

    CN115359376A

  • Lightweight military target detection method based on SMCA-YOLOv5

    CN115424091A

  • Pedestrian detection method, system and device of improved YOLOv4 network and medium

    CN116012879A

  • Unmanned aerial vehicle aerial photography small target detection method based on improved YOLOv7 algorithm

    CN116597326A

  • Improved lightweight model EM2-YOLO target detection algorithm based on Yolov4

    CN117876846A