Object identification method and system under overlooking view angle of unmanned aerial vehicle based on YOLOv5s model
By introducing the MobileNetv3 network and cross-channel-spatial attention module into the YOLOv5s model, the loss function is optimized, which solves the problem of poor recognition effect and slow processing speed of the object recognition model from the drone's overhead perspective, and achieves more efficient recognition. accuracy and calculation speed.
Patent Information
- Application Number
- CN202410631971.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-21
- Publication Date
- 2024-09-06
AI Technical Summary
The object recognition model in the existing technology from the overhead perspective of a drone has poor recognition results, slow processing speed and high consumption of computing resources, making it difficult to effectively identify objects in complex environments.
An optimization method based on the YOLOv5s model is adopted, by introducing the MobileNetv3 network structure and cross-channel-spatial attention module, and replacing the loss function CIOU with EIOU, optimizing the network structure and hyperparameters to improve recognition accuracy and speed.
It significantly improves the calculation speed of the object recognition model from the drone's overhead perspective, reduces computing resource consumption and energy consumption, and improves the recognition accuracy and robustness.
Smart Images

Figure CN118608989A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to an object recognition method and system based on a YOLOv5s optimization model in a bird's-eye view of an unmanned aerial vehicle. Background Art
[0002] With the rapid development of drone technology, drones can fly in different environments and conditions and collect a large amount of image data. Therefore, their applications in agricultural monitoring, urban planning, traffic management, environmental monitoring and other fields are becoming more and more extensive, and the analysis and processing of these image data are crucial to improving the efficiency and accuracy of drone missions. As an important research direction in the field of computer vision, object recognition models play a key role in drone image data processing. By effectively identifying objects in images taken by drones, they can identify and quickly locate specific targets, thereby supporting more accurate decision-making and actions.
[0003] Deep learning technology, especially convolutional neural networks (CNN), has been widely used in object recognition tasks and has achieved remarkable results. As a deep learning model, the YOLO (You Only Look Once) series has achieved important results in the field of real-time object detection and has attracted widespread attention for its high efficiency and high accuracy. As a lightweight model in the YOLO series, YOLOv5s is particularly suitable for application scenarios with strict requirements on real-time performance and resource consumption.
[0004] In practical applications, object recognition from a drone’s bird’s-eye view faces unique challenges, including small object size, large viewing angle changes, and complex backgrounds. These factors make it difficult to directly apply traditional object recognition methods or the application effect is poor. Therefore, it is necessary to optimize the object recognition method specifically for drones’ bird’s-eye view to improve the accuracy and robustness of the object recognition model. At the same time, although certain progress has been made in the field of drone image object recognition in recent years, how to further improve the processing speed and reduce computing resource consumption while ensuring recognition accuracy is still an urgent problem to be solved. In addition, how to effectively deal with complex environmental factors such as high dynamic range and high illumination changes is also a challenge faced by current object recognition model research. Summary of the invention
[0005] To this end, the technical problem to be solved by the present invention is to overcome the problems in the prior art that the object recognition model has poor recognition effect under the bird's-eye view of the drone, slow processing speed and large consumption of computing resources, and thus provide an object recognition method under the bird's-eye view of the drone based on the YOLOv5s optimization model, which significantly improves the calculation speed and reduces the consumption of computing resources and energy consumption while ensuring the recognition accuracy.
[0006] In order to solve the above technical problems, the present invention provides an object recognition method based on the YOLOv5s model in a bird's-eye view of an unmanned aerial vehicle, comprising the following steps:
[0007] Step S1, obtaining an image from a bird's-eye view of a drone, and annotating the target image using an annotation tool, creating an image dataset and dividing it into a training set, a validation set, and a test set according to a preset ratio;
[0008] Step S2, preprocessing the image data set, configuring the training environment and initial network hyperparameters of the YOLOv5s optimization model;
[0009] Step S3, introducing a cross-channel-spatial attention module into the YOLOv5s optimization model with the MobileNetv3 network structure as the backbone network, and replacing the loss function CIOU with EIOU, training the YOLOv5s optimization model using the training set, and verifying the effect of the YOLOv5s optimization model using the verification set to obtain a trained YOLOv5s optimization model;
[0010] Step S4: Perform a terminal performance test on the test set using the trained YOLOv5s optimization model to evaluate the performance of the trained YOLOv5s optimization model, and use the trained YOLOv5s optimization model to detect the target area to obtain a recognition result.
[0011] In one embodiment of the present invention, the step S1 further includes the following steps:
[0012] Step S11, obtaining a number of images randomly captured by the drone after reaching a preset height, annotating the images using the labelImg annotation tool, and constructing the annotated images into an image dataset;
[0013] Step S12: using rectangular frames to mark people, cars, and bicycles in the image data set to obtain three labels, and fusing the labeled images, and dividing the fused images into a training set, a validation set, and a test set according to a predetermined ratio.
[0014] In one embodiment of the present invention, in step S2,
[0015] The initial network hyperparameters were tuned by an optimizer, wherein the learning rate momentum was 0.937; the weight decay coefficient was 0.0005; and the learning rate was dynamically adjusted using a cosine annealing algorithm.
[0016] In one embodiment of the present invention, in step S3,
[0017] The attention mechanism is introduced into the YOLOv5s optimization model with the MobileNetv3-Large network as the backbone network and the network structure is optimized. The MobileNetv3-Large network includes the following steps:
[0018] Step S31: normalize the input image and adjust the image to a preset size to ensure that the data processed by the model is consistent;
[0019] Step S32: Perform preliminary feature extraction on the preprocessed image through a common convolution layer, use multiple depth-wise separable convolution layers to further extract spatial features, and then use point-by-point convolution to merge channel information;
[0020] Step S33: The MobileNetV3-Large network uses a Squeeze-and-Excitation module to adjust the importance of feature channels; the Squeeze-and-Excitation module is implemented by global average pooling, a fully connected layer, ReLU, and a Sigmoid activation function;
[0021] Step S34: using an inverted residual structure, after expanding the feature dimension, performing a depthwise separable convolution on the features enhanced by the Squeeze-and-Excitation module, and finally compressing the feature dimension by point-by-point convolution, and performing a residual connection with the input; the image features are further compressed by one or more tail convolution layers, and then each feature map is reduced to a single value by a global average pooling layer;
[0022] Step S35: Map the pooled features to the target category through a fully connected layer, and use a softmax activation function to output the probability of each category.
[0023] In one embodiment of the present invention, a cross-layer feature fusion module based on the cross-channel-spatial attention module is included, and the cross-layer feature fusion module introduces a learnable weight for features of different sizes in the channel domain and the spatial domain; the calculation formula of the cross-layer feature fusion module is as follows:
[0024] Z=Concat(X,Y)⊙Sigmoid(STA(A))
[0025] Where: X and Y represent the features to be fused, XY represents the initial fused features obtained after the Concat operation; A represents the features output by Backbone, A' represents the attention weight matrix obtained after the cross-channel-spatial attention module and the Sigmoid activation function; ⊙ represents the Element-wise product operation; Z represents the final fused features.
[0026] In one embodiment of the present invention, the cross-channel-spatial attention module is used to dynamically allocate weights, specifically comprising the following steps:
[0027] Step 1: The features to be fused X and Y are fused through the Concat operation to obtain the initial fused features XY;
[0028] Step 2: After feature A passes through the cross-channel-spatial attention module, the attention weight matrix A' is obtained, and after being processed by the Sigmoid activation function, the value range of A' is 0 to 1; finally, the element-wise product operation is performed on the initially fused feature XY and the weight matrix A' to obtain the final fused feature Z.
[0029] In one embodiment of the present invention, in step S3, the loss function includes object confidence loss, category loss and bounding box loss, wherein the bounding box loss function is:
[0030]
[0031] Among them, the IoU is the ratio of the intersection and union between the predicted box and the real box, ρ 2 (b,b gt ) is the square of the Euclidean distance between the center points of the predicted box and the true box, c is the diagonal length of the minimum closed area containing the two boxes, and w and h are the width and height of the predicted box.
[0032] In one embodiment of the present invention, the cross-channel-spatial attention module is introduced into the backbone network, and the cross-channel-spatial attention module includes a channel attention branch and two spatial attention branches. The cross-channel-spatial attention module adds and averages the output features of the attention branch and the two spatial attention branches.
[0033] In one embodiment of the present invention, step S4 includes,
[0034] The performance of the trained YOLOv5s optimization model is tested and evaluated using the test data set, where the evaluation indicators include average precision mean and frame rate.
[0035] To solve the above problems,
[0036] Also provided is an object recognition system based on the YOLOv5s optimization model in a drone's bird's-eye view, the system being used to implement the object recognition method, specifically comprising:
[0037] The data acquisition module is used to obtain images from the drone's bird's-eye view, annotate the target images through annotation tools, create an image data set, and divide it into a training set, a validation set, and a test set according to a preset ratio;
[0038] A data preprocessing module, used to preprocess the image data set and configure the training environment and initial network hyperparameters of the YOLOv5s optimization model;
[0039] A network training module is used to introduce a cross-channel-spatial attention module on the YOLOv5s optimization model using the MobileNetv3 network structure as the backbone network, and replace the loss function CIOU with EIOU, train the YOLOv5s optimization model using the training set, and verify the effect of the YOLOv5s optimization model using the verification set to obtain a trained YOLOv5s optimization model;
[0040] The evaluation and recognition module is used to perform terminal performance test on the trained YOLOv5s optimization model on the test set, evaluate the performance of the trained YOLOv5s optimization model, detect the target area using the trained YOLOv5s optimization model, and obtain the recognition result.
[0041] In one embodiment of the present invention, the initial network hyperparameters are: initial learning rate is 0.001; batch-size is set to 1; the total number of training times is 100 Epochs.
[0042] The above technical solution of the present invention has the following advantages compared with the prior art:
[0043] In the object recognition method described in the present invention, the YOLOv5s optimization model with the MobileNetv3 network structure as the backbone network simplifies the complexity of the model architecture, greatly improves the calculation speed, and thus reduces energy consumption; a cross-channel-spatial attention module is introduced into the MobileNetv3 network structure, so that the YOLOv5s optimization model can effectively capture the feature mapping relationship between different dimensions, thereby improving the detection accuracy of the YOLOv5s optimization model without increasing the calculation overhead. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below according to specific embodiments of the present invention in conjunction with the accompanying drawings, wherein
[0045] Figure 1 This is a flowchart of a method for object recognition from a bird's-eye view of a drone based on a YOLOv5s optimization model in a preferred embodiment of the present invention.
[0046] Figure 2This is a structural diagram of Bneck of the MobileNetv3 network structure in the preferred embodiment of the present invention.
[0047] Figure 3 Network structure diagram of the optimized model for YOLOv5s.
[0048] Figure 4 Structural diagram of the cross-channel-spatial attention module.
[0049] Figure 5 This is the structural diagram of the cross-layer feature fusion module. DETAILED DESCRIPTION
[0050] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0051] Reference Figure 1 and 3 As shown, in one embodiment of the present invention, a method for object recognition based on a YOLOv5s model in a drone's bird's-eye view includes the following steps:
[0052] Step S1, obtaining an image from a bird's-eye view of a drone, and annotating the target image using an annotation tool, creating an image dataset and dividing it into a training set, a validation set, and a test set according to a preset ratio;
[0053] Step S2, preprocessing the image data set, configuring the training environment and initial network hyperparameters of the YOLOv5s optimization model;
[0054] Step S3, introducing a cross-channel-spatial attention module into the YOLOv5s optimization model with the MobileNetv3 network structure as the backbone network, and replacing the loss function CIOU with EIOU, training the YOLOv5s optimization model using the training set, and verifying the effect of the YOLOv5s optimization model using the verification set to obtain a trained YOLOv5s optimization model;
[0055] Step S4: Perform a terminal performance test on the test set using the trained YOLOv5s optimization model to evaluate the performance of the trained YOLOv5s optimization model, and use the trained YOLOv5s optimization model to detect the target area to obtain a recognition result.
[0056] The above training was carried out in Windows 10 system, using NVIGIAGEFORCE RTX 1050Ti graphics processing unit (GPU) and CUDA 11.3 acceleration environment.
[0057] In the above scheme, if Figure 3 As shown, a cross-channel-spatial attention module (STA) is introduced in Backbone, and the channel-spatial attention (SA-Net) is combined with the cross-channel attention (Triplet) to obtain a cross-channel-spatial attention module (SA-Triplet attention, STA), which effectively captures the feature mapping relationship between different dimensions, improves the detection accuracy of the model, and improves the detection accuracy of the model without increasing the computational overhead. The problem that the image resolution is continuously reduced during the process of Backbone continuously convolving and extracting features from the input image, resulting in the loss of feature information of small target objects with smaller resolution in the image; in order to compensate for the accuracy loss caused by the lightweight model, a cross-channel-spatial attention module is added after the Bneck structure in the MobileNetv3 network to improve the model's ability to capture effective features.
[0058] like Figure 2 As shown in the figure, the MobileNetv3 series of algorithms change the traditional convolution model to a deep separable convolution model, reduce the amount of calculation and parameters, speed up the operation, and enable it to handle complex problems more effectively. Among them, the deep separable convolution consists of two parts: deep convolution and 1×1 point-by-point convolution. By using filters and linear combination technology, the complexity of parameters can be greatly reduced, saving computing costs. The MobileNetv3 network structure is characterized by a small model size, a small number of parameters, and high accuracy. It can meet a variety of complex classification, detection, image segmentation and other requirements, and can achieve good operation results at a variety of computing power levels.
[0059] As the basic module, the Bneck structure adopts 1×1 convolution technology, which can effectively increase the dimension, so as to better utilize the feature information obtained in the high-dimensional space for in-depth research; it adopts the deep separable convolution technology and integrates the Squeeze-and-Excitation module to achieve effective adjustment of the weights of various channels and improve the performance and efficiency of the system. When the step size is set to 1, the output and input can be processed by residual; the 1×1 convolution algorithm can effectively reduce the dimension. The Bneck structure is as follows: Figure 2 shown.
[0060] like Figure 3As described above, after the introduction of MobileNetv3, the YOLOv5s network model obtains a feature matrix of 96×13×13, which is first convolved by 1×1 to obtain a feature matrix of 48×13×13, and then input to the spatial pyramid layer (SpatialPooling Layer, SPP) module, and downsampled in 3 parallel maximum pooling locations. Since each step size is 1, the result is 48×13×13; then, the result is added to the feature matrix input to the module in depth to obtain a feature matrix of 182×13×13; finally, a convolution kernel of 96×96 is used for convolution to restore the feature matrix to 96×13×13. The spatial pyramid structure is used in the neck, and the feature pyramid (Feature Pyramid Network, FPN) conveys strong semantic (High-Level) features from top to bottom, and the path aggregation network (Path Aggregation Network, PAN) conveys strong displacement (Low-Level) features from bottom to top. The combination of the two improves the ability to extract feature information.
[0061] In one embodiment of the present invention, the step S1 further includes the following steps:
[0062] Step S11, obtaining a number of images randomly captured by the drone after reaching a preset height, annotating the images using the labelImg annotation tool, and constructing the annotated images into an image dataset;
[0063] Step S12: using rectangular frames to mark people, cars, and bicycles in the image data set to obtain three labels, and fusing the labeled images, and dividing the fused images into a training set, a validation set, and a test set according to a predetermined ratio.
[0064] In one embodiment of the present invention, in step S2,
[0065] The initial network hyperparameters were tuned by an optimizer, wherein the learning rate momentum was 0.937; the weight decay coefficient was 0.0005; and the learning rate was dynamically adjusted using a cosine annealing algorithm.
[0066] In one embodiment of the present invention, in step S3,
[0067] The YOLOv5s optimization model with the MobileNetv3-Large network as the backbone network introduces the attention mechanism and optimizes the network structure, which improves the representation ability of the model while maintaining low computational complexity, so that MobileNetV3-Large can have better adaptability and generalization ability when processing different tasks. The MobileNetv3-Large network includes the following steps:
[0068] Step S31: normalize the input image and adjust the image to a preset size to ensure that the data processed by the model is consistent;
[0069] Step S32: Perform preliminary feature extraction on the preprocessed image through a common convolution layer, use multiple depth-wise separable convolution layers to further extract spatial features, and then use point-by-point convolution to merge channel information;
[0070] Step S33: The MobileNetV3-Large network uses a Squeeze-and-Excitation module to adjust the importance of feature channels; the Squeeze-and-Excitation module is implemented by global average pooling, a fully connected layer, ReLU, and a Sigmoid activation function;
[0071] Step S34: using an inverted residual structure, after expanding the feature dimension, performing a depthwise separable convolution on the features enhanced by the Squeeze-and-Excitation module, and finally compressing the feature dimension by point-by-point convolution, and performing a residual connection with the input; the image features are further compressed by one or more tail convolution layers, and then each feature map is reduced to a single value by a global average pooling layer;
[0072] Step S35: Map the pooled features to the target category through a fully connected layer, and use a softmax activation function to output the probability of each category.
[0073] In one embodiment of the present invention, Figure 5 As shown, it includes a cross-layer feature fusion module (STA-FF) based on the cross-channel-spatial attention module, and the cross-layer feature fusion module introduces a learnable weight for features of different sizes in the channel domain and the spatial domain; the calculation formula of the cross-layer feature fusion module is as follows:
[0074] Z=Concat(X,Y)⊙Sigmoid(STA(A))
[0075] Where: X and Y represent the features to be fused, XY represents the initial fused features obtained after the Concat operation; A represents the features output by Backbone, A' represents the attention weight matrix obtained after the cross-channel-spatial attention module and the Sigmoid activation function; ⊙ represents the Element-wise product operation; Z represents the final fused features.
[0076] In one embodiment of the present invention, the cross-channel-spatial attention module is used to dynamically allocate weights, specifically comprising the following steps:
[0077] Step 1: The features to be fused X and Y are fused through the Concat operation to obtain the initial fused features XY;
[0078] Step 2: After feature A passes through the cross-channel-spatial attention module, the attention weight matrix A' is obtained, and after being processed by the Sigmoid activation function, the value range of A' is 0 to 1; finally, the element-wise product operation is performed on the initially fused feature XY and the weight matrix A' to obtain the final fused feature Z.
[0079] In one embodiment of the present invention, the loss function includes object confidence loss, category loss and bounding box loss, wherein the bounding box loss adopts the complete IoU (Intersection over Union) loss, i.e., CIoU loss, and the definition of CIoU loss is as follows:
[0080]
[0081]
[0082]
[0083] However, the accuracy of CIoU depends on the position and confidence of the object. Therefore, the EIoU loss function is used. EIoU is an improvement on CIoU, which adds the loss of length and width to make up for the shortcomings of CIoU. The bounding box loss function EIoU is:
[0084]
[0085] Among them, IoU is the difference between the predicted box (b) and the real box (b gt ) is the ratio of the intersection to the union; ρ 2 (b,b gt ) is the square of the Euclidean distance between the center points of the predicted box and the true box; c is the diagonal length of the minimum closed area containing the two boxes, α is the weight of the aspect ratio penalty; ν(b,b gt ) Evaluate the consistency of the aspect ratio between the predicted box and the real box; w gt 、h gt is the width and height of the real box, w and h are the width and height of the predicted box.
[0086] In one embodiment of the present invention, the cross-channel-spatial attention module is introduced into the backbone network, and the cross-channel-spatial attention module includes a channel attention branch and two spatial attention branches. The cross-channel-spatial attention module adds and averages the output features of the attention branch and the two spatial attention branches.
[0087] Specifically, Figure 4 As shown in Figure 1, the cross-channel-spatial attention module is divided into three branches: the first branch is the channel attention branch. The input feature C×H×W (C, H, and W represent the depth, height, and width of the feature, respectively) is first split by the Split operation to evenly divide the number of channels of the input feature to obtain two sets of feature matrices C / 2×H×W, and then undergo average pooling (AvgPool) and maximum pooling (MaxPool) to become 1×H×W, and then undergo F(x) processing and Sigmoid activation function to generate weights, and then the weights are Element-wise combined with the feature matrix C / 2×H×W. product operation, and finally the output feature C×H×W of the first branch is obtained through the Concat operation and the ChannelShuffle operation; the second branch is the spatial attention branch, and the channel C dimension and the spatial W dimension interact to process the feature information. The input feature C×H×W is first transformed into H×C×W through the Permute operation, and then transformed into 2×C×W through the Z-Pool operation (the results of the maximum pooling and the mean pooling are spliced together in the channel direction), and then transformed into 1×C×W through the CBR process, and then the weight is generated through the Sigmoid activation function, and finally the weight is Element-wise compared with the input feature H×C×W product operation, and the output feature C×H×W of the second branch is obtained through the Permute operation; the third branch is also a spatial attention branch, and the channel C dimension and the spatial H dimension interact to process feature information. The input feature C×H×W is first converted to W×H×C through the Permute operation, and then converted to 2×H×C through the Z-Pool operation, and then converted to 1×H×C through the CBR process, and then the weight is generated through the Sigmoid activation function. Finally, the weight is Element-wise product operation is performed with the input feature W×H×C, and the output feature C×H×W of the third branch is obtained through the Permute operation;
[0088] The cross-channel-spatial attention module adds and averages the output features of the above three branches.
[0089] Figure 4 In the formula, F(x) represents the matrix multiplication and addition operations, the purpose of which is to enhance the expressive power of features and thus capture more effective feature information. The calculation formula is as follows:
[0090] F(x)=ωx+b
[0091] Where: ω represents the weight matrix, b represents the bias vector.
[0092] In one embodiment of the present invention, step S4 includes,
[0093] The performance of the trained YOLOv5s optimization model is tested and evaluated using the test data set, where the evaluation indicators include average precision mean and frame rate.
[0094] During the experiment, the performance of different algorithms was compared. The main evaluation indicators were the mean average precision (mAP) and the detection speed (FPS). In the target detection process, T and F indicate whether the classification is correct, P and N represent positive samples and negative samples respectively, TP (True Positives) indicates that the positive samples are correctly identified, TN (True Negatives) indicates that the negative samples are correctly identified, FP (False Positives) indicates that the negative samples are misdetected, and FN (False Negatives) indicates that the positive samples are missed. AP (Average Precision) is the average precision, that is, the average value of each precision value on the PR curve, and the expression is
[0095]
[0096] For each category, calculate the AP value according to the above method, and take the average AP value of all categories to be mapped:
[0097]
[0098] The precision and recall are
[0099]
[0100]
[0101] The model was trained using a self-built dataset, and ablation experiments were conducted on the improved steps. The effectiveness of the algorithm improvement was confirmed by comparing the number of parameters, mAP value, and FPS. The optimization of the backbone network, adjustment of the loss function, and the organic combination of the two technologies were used, and the ablation experiments were used to verify and analyze them. The results are shown in Table 1.
[0102] As can be seen from Table 1, the lightweight optimization of MobileNetv3 for the backbone network increases the detection speed of the model from 30 frames / s to 33 frames / s. After the optimization of the loss function, the mAP value increases from 83.27% to 83.35%, and the detection speed increases from 30 frames / s to 33 frames / s. Compared with YOLOv5s, the YOLOv5s optimization model after combining the two optimizations has an increased detection speed from 30 frames / s to 37 frames / s, and the number of parameters is reduced from 7.33M to 6.41M. Experiments show that the improved method of the present invention has a certain improvement effect.
[0103] Table 1 Improvement of algorithm performance by different improvement methods
[0104]
[0105]
[0106] The YOLOv5s-M3 algorithm is compared with other lightweight algorithms, and the results are shown in Table 2.
[0107] Table 2 Comparison of AP and mAP of different algorithms
[0108]
[0109] As can be seen from Tables 1 and 2, the proposed YOLOv5s optimization model algorithm has a 0.34% decrease in mAP value compared to the YOLOv5s algorithm, but the number of parameters is reduced by 0.92M, and the detection speed is increased by 7 frames / s. In addition, compared with the training results of the lightweight algorithm YOLOv5s-lite in the test set, the proposed improved method has better detection accuracy.
[0110] In order to solve the problem that small target detection is difficult for vehicle detection algorithms, the present invention is based on the YOLOv5s algorithm. By replacing the original backbone network structure with the MobileNetv3 network structure, the EIOU function is used to improve the loss function, the complexity of the model is reduced, the number of model parameters is reduced, and the detection speed of the model is improved. Experimental verification shows that the mAP value of the algorithm of the optimized YOLOv5s optimization model is better than that of other lightweight algorithms, and it has stronger robustness.
[0111] To solve the above problems,
[0112] Also provided is an object recognition system based on the YOLOv5s optimization model in a drone's bird's-eye view, the system being used to implement the object recognition method, specifically comprising:
[0113] The data acquisition module is used to obtain images from the drone's bird's-eye view, annotate the target images through annotation tools, create an image data set, and divide it into a training set, a validation set, and a test set according to a preset ratio;
[0114] A data preprocessing module, used to preprocess the image data set and configure the training environment and initial network hyperparameters of the YOLOv5s optimization model;
[0115] A network training module is used to introduce a cross-channel-spatial attention module on the YOLOv5s optimization model using the MobileNetv3 network structure as the backbone network, and replace the loss function CIOU with EIOU, train the YOLOv5s optimization model using the training set, and verify the effect of the YOLOv5s optimization model using the verification set to obtain a trained YOLOv5s optimization model;
[0116] The evaluation and recognition module is used to perform terminal performance test on the trained YOLOv5s optimization model on the test set, evaluate the performance of the trained YOLOv5s optimization model, detect the target area using the trained YOLOv5s optimization model, and obtain the recognition result.
[0117] In one embodiment of the present invention, the initial network hyperparameters are: initial learning rate is 0.001; batch-size is set to 1; the total number of training times is 100 Epochs.
[0118] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0119] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0120] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1A function specified in one or more boxes.
[0121] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0122] Obviously, the above embodiments are merely examples for clear explanation and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived from these are still within the protection scope of the invention.
Claims
1. The object recognition method based on the YOLOv5s model in the top-down perspective of the drone is characterized by , including the following steps: Step S1, obtaining an image from a bird's-eye view of a drone, and annotating the target image using an annotation tool, creating an image dataset and dividing it into a training set, a validation set, and a test set according to a preset ratio; Step S2, preprocessing the image data set, configuring the training environment and initial network hyperparameters of the YOLOv5s optimization model; Step S3, introducing a cross-channel-spatial attention module into the YOLOv5s optimization model with the MobileNetv3 network structure as the backbone network, and replacing the loss function CIOU with EIOU, training the YOLOv5s optimization model using the training set, and verifying the effect of the YOLOv5s optimization model using the verification set to obtain a trained YOLOv5s optimization model; Step S4: Perform a terminal performance test on the test set using the trained YOLOv5s optimization model to evaluate the performance of the trained YOLOv5s optimization model, and use the trained YOLOv5s optimization model to detect the target area to obtain a recognition result.
2. The object recognition method according to claim 1, characterized in that: The step S1 further comprises the following steps: Step S11, obtaining a number of images randomly captured by the drone after reaching a preset height, annotating the images using the labelImg annotation tool, and constructing the annotated images into the image dataset; Step S12: using rectangular frames to mark people, cars, and bicycles in the image data set to obtain three labels, and fusing the labeled images, and dividing the fused images into the training set, the verification set, and the test set according to a predetermined ratio.
3. The object recognition method according to claim 1, characterized in that: In step S2, the initial network hyperparameters are tuned by an optimizer, wherein the learning rate momentum is 0.937; the weight decay coefficient is 0.0005; and the learning rate is dynamically adjusted using a cosine annealing algorithm.
4. The object recognition method according to claim 1, characterized in that: In step S3, the attention mechanism is introduced into the YOLOv5s optimization model with the MobileNetv3-Large network as the backbone network and the network structure is optimized. The MobileNetv3-Large network includes the following steps: Step S31: normalize the input image and adjust the image to a preset size to ensure that the data processed by the model is consistent; Step S32: Perform preliminary feature extraction on the preprocessed image through a common convolution layer, use multiple depth-wise separable convolution layers to further extract spatial features, and then use point-by-point convolution to merge channel information; Step S33: The MobileNetV3-Large network uses a Squeeze-and-Excitation module to adjust the importance of feature channels; the Squeeze-and-Excitation module is implemented by global average pooling, a fully connected layer, ReLU, and a Sigmoid activation function; Step S34: using an inverted residual structure, after expanding the feature dimension, performing a depthwise separable convolution on the features enhanced by the Squeeze-and-Excitation module, and finally compressing the feature dimension by point-by-point convolution, and performing a residual connection with the input; the image features are further compressed by one or more tail convolution layers, and then each feature map is reduced to a single value by a global average pooling layer; Step S35: Map the pooled features to the target category through a fully connected layer, and use a softmax activation function to output the probability of each category.
5. The object recognition method according to claim 1, characterized in that: It includes a cross-layer feature fusion module based on the cross-channel-spatial attention module, wherein the cross-layer feature fusion module introduces a learnable weight for features of different sizes in the channel domain and the spatial domain; the calculation formula of the cross-layer feature fusion module is as follows: Z=Concat(X,Y)⊙Sigmoid(STA(A)) Where: X and Y represent the features to be fused, XY represents the initial fused features obtained after the Concat operation; A represents the features output by Backbone, A' represents the attention weight matrix obtained after the cross-channel-spatial attention module and the Sigmoid activation function; ⊙ represents the Element-wise product operation; Z represents the final fused features.
6. The object recognition method according to claim 1, characterized in that: The cross-channel-spatial attention module is used to dynamically allocate weights, specifically including the following steps: Step 1: The features to be fused X and Y are fused through the Concat operation to obtain the initial fused features XY; Step 2; The attention weight matrix A' is obtained after feature A passes through the cross-channel-spatial attention module, and the value range of A' is 0 to 1 after being processed by the Sigmoid activation function; finally, the element-wise product operation is performed on the initially fused feature XY and the weight matrix A' to obtain the final fused feature Z.
7. The object recognition method according to claim 1, characterized in that: In step S3, the loss function includes object confidence loss, category loss and bounding box loss, wherein the bounding box loss function is: Among them, the IoU is the ratio of the intersection and union between the predicted box and the real box, ρ 2 (b,b gt ) is the square of the Euclidean distance between the center points of the predicted box and the true box, c is the diagonal length of the minimum closed area containing the two boxes, and w and h are the width and height of the predicted box.
8. The object recognition method according to claim 1, characterized in that: In step S3, the cross-channel-spatial attention module is introduced into the backbone network. The cross-channel-spatial attention module includes a channel attention branch and two spatial attention branches. The cross-channel-spatial attention module adds and averages the output features of the attention branch and the two spatial attention branches.
9. The object recognition method according to claim 1, characterized in that: Step S4 includes using a test data set to perform performance testing and evaluation on the trained YOLOv5s optimization model, wherein the evaluation indicators include average precision mean and frame rate.
10. An object recognition system based on the YOLOv5s optimization model in the top-down view of a drone, characterized by The system is used to implement the object recognition method according to any one of claims 1 to 9, specifically comprising: The data acquisition module is used to obtain images from the drone's bird's-eye view, annotate the target images through annotation tools, create an image data set, and divide it into a training set, a validation set, and a test set according to a preset ratio; A data preprocessing module, used to preprocess the image data set and configure the training environment and initial network hyperparameters of the YOLOv5s optimization model; A network training module is used to introduce a cross-channel-spatial attention module on the YOLOv5s optimization model using the MobileNetv3 network structure as the backbone network, and replace the loss function CIOU with EIOU, train the YOLOv5s optimization model using the training set, and verify the effect of the YOLOv5s optimization model using the verification set to obtain a trained YOLOv5s optimization model; The evaluation and recognition module is used to perform terminal performance test on the trained YOLOv5s optimization model on the test set, evaluate the performance of the trained YOLOv5s optimization model, detect the target area using the trained YOLOv5s optimization model, and obtain the recognition result.
Citation Information
Patent Citations
Lightweight target detection method
CN114120019A
Method and apparatus for obstacle detection in complex weather
WO2024051296A1
Cited By
Personalized video special effect matching method and device based on artificial intelligence and computer readable storage medium
CN119048965A
Method and device for identifying malignant cells
CN119399755A
Unmanned aerial vehicle target detection method based on improved attention mechanism
CN119478747A
Cable well section image recognition model training method, recognition method and system
CN120088448A
Unmanned aerial vehicle small target identification method, system and device and storage medium
CN120526108A
