Target detection method and device based on improved YOLOv5 and electronic equipment

By improving the YOLOv5 model and employing rotated bounding box annotation and attention module training, the problem of low accuracy in detecting small targets in remote sensing images was solved, thus improving the accuracy and robustness of target detection in remote sensing images.

CN117173474BActive Publication Date: 2026-06-05JIAXUN FEIHONG (BEIJING) INTELLIGENT TECH RES INST CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JIAXUN FEIHONG (BEIJING) INTELLIGENT TECH RES INST CO LTD
Filing Date
2023-09-04
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing remote sensing image target detection technologies have low accuracy in detecting small targets, especially because the targets are too small and the noise content within the target box is relatively high. Existing algorithm improvements have not been able to effectively improve detection performance.

Method used

The YOLOv5 model was trained using VEDAI remote sensing data with rotated bounding boxes. By adding an attention module and adjusting the loss function, the model's ability to detect small targets was improved.

Benefits of technology

It improves the accuracy of target detection in remote sensing images, reduces the proportion of noise within the target bounding box, and enhances the model's generalization ability and robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117173474B_ABST
    Figure CN117173474B_ABST
Patent Text Reader

Abstract

The application provides a target detection method based on improved YOLOv5, comprising: acquiring a to-be-detected remote sensing image; inputting the to-be-detected remote sensing image into a pre-trained target detection model based on YOLOv5 to output a target detection result of the to-be-detected remote sensing image; the target detection model based on YOLOv5 is obtained by training based on VEDAI remote sensing data labeled by using a rotating target frame; and determining a target object in the to-be-detected remote sensing image according to the target detection result. The method trains the target detection model based on YOLOv5 by using the VEDAI remote sensing data labeled by using the rotating target frame, so as to alleviate the problems of too small target and too large noise proportion in the target frame in the prior art by using the target detection model based on YOLOv5, and thus the target detection precision of the remote sensing image is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of remote sensing image target detection technology, and in particular to a target detection method, apparatus and electronic device based on an improved YOLOv5. Background Technology

[0002] Small target detection is a significant challenge in remote sensing image target detection because many targets in remote sensing images are quite small, placing higher demands on target detection algorithms. Current deep learning algorithms mainly include two-stage detection algorithms such as R-CNN and Faster R-CNN, and single-stage detection algorithms such as SSD and YOLO. However, these algorithms do not perform well when directly applied to remote sensing images. While there are improvements to algorithms specifically for small targets, they haven't addressed the unique characteristics of targets in remote sensing and UAV images. Therefore, even with current optimized algorithms, there is no significant improvement in target detection performance for remote sensing and UAV images.

[0003] Existing remote sensing image target detection technologies mainly focus on simply adding a detection layer to ordinary small targets in order to improve the detection capability of small targets. However, since small targets have few features and the noise ratio within the target box is relatively large, the detection of small targets has not been significantly improved.

[0004] Overall, the accuracy of existing target detection methods for remote sensing images is relatively low. Summary of the Invention

[0005] The purpose of this invention is to provide a target detection method, apparatus, and electronic device based on an improved YOLOv5, so as to alleviate the problem that the targets in the remote sensing images are too small and the noise ratio in the target box is too large in the prior art, thereby improving the target detection accuracy of the remote sensing images.

[0006] In a first aspect, embodiments of the present invention provide a target detection method based on an improved YOLOv5, comprising: acquiring a remote sensing image to be detected; inputting the remote sensing image to be detected into a pre-trained target detection model based on YOLOv5, and outputting a target detection result of the remote sensing image to be detected; the target detection model based on YOLOv5 is trained using VEDAI remote sensing data annotated with rotated bounding boxes; and determining the target object in the remote sensing image to be detected based on the target detection result.

[0007] In a preferred embodiment of the present invention, the YOLOv5-based target detection model is trained using the following steps: acquiring initial VEDAI remote sensing image data; using an image annotation tool to annotate the target objects in the initial VEDAI remote sensing image data with rotated bounding boxes to obtain a preprocessed image carrying annotation information; dividing the preprocessed image into a training set, a validation set, and a test set based on a preset ratio; inputting the training set into the initial target detection model built using a YOLOv5 network for training until a preset training termination criterion is reached to obtain a first intermediate detection model; inputting the validation set into the first intermediate detection model for validation until a preset validation termination criterion is reached to obtain a second intermediate detection model; inputting the test set into the second intermediate detection model for validation until a preset test termination criterion is reached to obtain a YOLOv5-based target detection model.

[0008] In a preferred embodiment of the present invention, the initial object detection model is constructed through the following steps: obtaining a YOLOv5 network; adding an object detection layer of a preset size to the YOLOv5 network to obtain an intermediate YOLOv5 network; adding preset attention detection code to the function storage file of the intermediate YOLOv5 network, and adding a second call instruction of the attention detection code after the first call instruction of the second downsampling in the function call file of the intermediate YOLOv5 network to obtain an attention-based YOLOv5 network; setting the configuration information of the attention-based YOLOv5 network to obtain a configured attention-based YOLOv5 network; and determining the initial object detection model based on the configured attention-based YOLOv5 network.

[0009] In a preferred embodiment of the present invention, the pooling method corresponding to the attention detection code is global max pooling.

[0010] In a preferred embodiment of the present invention, the step of determining the initial object detection model based on the YOLOv5 network with the configured attention module includes: adjusting the weights of the bounding box regression loss and the angle classification loss in the loss function of the YOLOv5 network with the configured attention module based on preset weight parameter expressions and preset hyperparameters, and adding a preset feature-based first loss function to the bounding box regression loss to obtain an adjusted second loss function; determining an improved YOLOv5 network based on the second loss function; and determining the improved YOLOv5 network as the initial object detection model.

[0011] In a preferred embodiment of the present invention, the above configuration information includes: the prior box parameters, feature extraction parameters, and category prediction parameters of the YOLOv5 network based on the attention module.

[0012] In a preferred embodiment of the present invention, the feature extraction parameters include: attention module parameters corresponding to the attention detection code.

[0013] In a preferred embodiment of the present invention, after the step of inputting the test set into the second intermediate detection model for verification until the preset test end criterion is reached to obtain the YOLOv5-based target detection model, the method further includes: evaluating the performance of the YOLOv5-based target detection model and determining the average accuracy of the YOLOv5-based target detection model.

[0014] Secondly, embodiments of the present invention provide a target detection device based on an improved YOLOv5, comprising: a data acquisition module for acquiring a remote sensing image to be detected; a model detection module for inputting the remote sensing image to be detected into a pre-trained YOLOv5-based target detection model and outputting a target detection result of the remote sensing image to be detected; the YOLOv5-based target detection model is trained using VEDAI remote sensing data annotated with rotated bounding boxes; and a target object determination module for determining target objects in the remote sensing image to be detected based on the target detection result.

[0015] Thirdly, embodiments of the present invention provide an electronic device, the electronic device including a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement any of the first to seventh possible implementations of the first aspect, the target detection method based on the improved YOLOv5 described above.

[0016] The embodiments of the present invention have the following beneficial technical effects:

[0017] This invention provides a target detection method, apparatus, and electronic device based on an improved YOLOv5, comprising: acquiring a remote sensing image to be detected; inputting the remote sensing image to be detected into a pre-trained YOLOv5-based target detection model, and outputting a target detection result for the remote sensing image to be detected; the YOLOv5-based target detection model is trained using VEDAI remote sensing data annotated with rotated bounding boxes; and determining the target object in the remote sensing image to be detected based on the target detection result. This method trains a YOLOv5-based target detection model using VEDAI remote sensing data annotated with rotated bounding boxes, thereby alleviating the problems of excessively small targets and high noise levels within the bounding boxes in existing technologies, and thus improving the target detection accuracy of remote sensing images.

[0018] Other features and advantages disclosed in this embodiment will be set forth in the following description, or some features and advantages may be inferred from the description or determined without doubt, or may be learned by practicing the techniques described above.

[0019] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0020] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0021] Figure 1 A flowchart illustrating a target detection method based on an improved YOLOv5 provided in an embodiment of the present invention;

[0022] Figure 2 A comparative diagram of rectangular annotation and rotated annotation provided for an embodiment of the present invention;

[0023] Figure 3 A flowchart illustrating a method for constructing a target detection model based on YOLOv5, provided in an embodiment of the present invention;

[0024] Figure 4 A schematic diagram of the sampling process of an intermediate YOLOv5 network provided for an embodiment of the present invention;

[0025] Figure 5 A schematic diagram of a target detection device based on an improved YOLOv5 provided in an embodiment of the present invention;

[0026] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.

[0027] Icons: 41-Processor; 42-Memory; 43-Bus; 44-Communication Interface; 51-Data Acquisition Module; 52-Model Detection Module; 53-Target Object Determination Module. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0029] Small target detection is a significant challenge in remote sensing image target detection because many targets in remote sensing images are quite small, placing higher demands on target detection algorithms. Current deep learning algorithms mainly include two-stage detection algorithms such as R-CNN and Faster R-CNN, and single-stage detection algorithms such as SSD and YOLO. However, these algorithms perform poorly when directly applied to remote sensing images. While there are improvements to algorithms specifically for small targets, they haven't addressed the unique characteristics of targets in remote sensing and UAV images. Therefore, even with current optimized algorithms, there isn't a significant improvement in target detection performance for remote sensing and UAV images. Existing remote sensing image target detection techniques primarily add a detection layer to improve the detection capability for ordinary small targets. However, because small targets have few features and the noise content within the target bounding box is high, the improvement in small target detection is not substantial. Overall, the accuracy of existing remote sensing image target detection methods is relatively low.

[0030] Based on this, embodiments of the present invention provide a target detection method, apparatus, and electronic device based on improved YOLOv5. This method trains a YOLOv5-based target detection model on VEDAI remote sensing data annotated with rotated bounding boxes. By using this YOLOv5-based target detection model, it alleviates the problems of excessively small targets and high noise levels within the bounding boxes in existing remote sensing images, thereby improving the target detection accuracy of remote sensing images. To facilitate understanding of the embodiments of the present invention, the improved YOLOv5-based target detection method disclosed in the embodiments of the present invention will first be described in detail.

[0031] Example 1

[0032] In this embodiment, Figure 1 This is a flowchart illustrating a target detection method based on an improved YOLOv5, provided as an embodiment of the present invention.

[0033] Depend on Figure 1 As seen, the method includes:

[0034] Step S101: Acquire the remote sensing image to be detected.

[0035] Step S102: Input the above-mentioned remote sensing image to be detected into the pre-trained YOLOv5-based target detection model, and output the target detection result of the above-mentioned remote sensing image to be detected; the above-mentioned YOLOv5-based target detection model is trained using VEDAI remote sensing data annotated with rotated target boxes.

[0036] For ease of understanding, Figure 2 This is a comparative diagram of rectangular annotation and rotated annotation provided in an embodiment of the present invention. Figure 2 As we can see, the current application scenarios of YOLOv5 are for targets in natural scenes, and the target detection bounding boxes are horizontal rectangles. However, for remote sensing images, which are viewed from above, the shape features of the target change. If we still use horizontal rectangles, we will add surrounding noise. Therefore, we use rotated target boxes for annotation, which can handle targets of various sizes, shapes and rotation angles, reduce redundant information, and have stronger generalization ability and robustness.

[0037] Step S103: Based on the above target detection results, determine the target objects in the above remote sensing image to be detected.

[0038] This invention provides an improved YOLOv5-based target detection method, comprising: acquiring a remote sensing image to be detected; inputting the remote sensing image to be detected into a pre-trained YOLOv5-based target detection model, and outputting the target detection result of the remote sensing image to be detected; the YOLOv5-based target detection model is trained using VEDAI remote sensing data annotated with rotated bounding boxes; and determining the target object in the remote sensing image to be detected based on the target detection result. This method trains the YOLOv5-based target detection model using VEDAI remote sensing data annotated with rotated bounding boxes, thereby alleviating the problems of excessively small targets and high noise levels within the bounding boxes in existing technologies, and thus improving the target detection accuracy of remote sensing images.

[0039] Example 2

[0040] Based on Example 1, this example focuses on the construction method of the target detection model based on YOLOv5 in Example 1. Figure 3 This is a flowchart illustrating a method for constructing a target detection model based on YOLOv5, as provided in an embodiment of the present invention.

[0041] Depend on Figure 3 As seen, the method includes:

[0042] Step S301: Acquire initial VEDAI remote sensing image data.

[0043] Step S302: Use an image annotation tool to annotate the target objects in the initial VEDAI remote sensing image data by rotating the target bounding box, and obtain a preprocessed image carrying annotation information.

[0044] In this embodiment, the above-mentioned annotation file uses the OpenCV notation.

[0045] Because of the added rotation angle, the rotation angle theta needs to be added to the output of YOLO-head. Taking the DOTA dataset as an example, the dataset has 15 categories, so the final output dimension is (5+1+15)*3=63. The first five parameters are used to determine the regression parameters of each feature point to obtain the predicted box, the sixth parameter determines whether it contains an object, and the last 15 parameters are used to determine the types of objects contained.

[0046] Step S303: Divide the preprocessed images into training set, validation set and test set based on a preset ratio.

[0047] Step S304: Input the above training set into the initial object detection model built with the YOLOv5 network for training until the preset training end standard is reached, and obtain the first intermediate detection model.

[0048] In this embodiment, the initial target detection model described above is constructed through the following steps A1-A5:

[0049] Step A1: Obtain the YOLOv5 network.

[0050] Step A2: Add a target detection layer of a preset size to the above YOLOv5 network to obtain an intermediate YOLOv5 network.

[0051] Step A3: Add preset attention detection code to the function storage file of the intermediate YOLOv5 network, and add the second call instruction of the attention detection code after the first call instruction of the second downsampling of the function call file of the intermediate YOLOv5 network to obtain the YOLOv5 network based on the attention module.

[0052] Here, the pooling method corresponding to the attention detection code above is global max pooling.

[0053] For ease of understanding, Figure 4 This is a schematic diagram of the sampling process of an intermediate YOLOv5 network provided in an embodiment of the present invention.

[0054] Depend on Figure 4As seen, the existing YOLOv5 has five downsampling operations, resulting in feature representations P1, P2, P3, P4, and P5. Taking an image input size of 608x608 as an example, the corresponding feature map sizes are (76x76), (38x38), and (19x19). The 76x76 feature map corresponds to a receptive field of 8x8 on the input image. However, for remote sensing images, even 4K images, when scaled to 608x608, the target pixels are often smaller than 8x8. Therefore, based on the original YOLOv5, a new detection head with a resolution of 152x152 is introduced at the P2 feature representation. This new head contains richer low-level feature information about the target. This feature is then fused with the same-scale features in the backbone network using a concat method, which can improve the detection of small targets.

[0055] Step A4: Set the configuration information of the YOLOv5 network based on the attention module to obtain the configured YOLOv5 network based on the attention module.

[0056] In one embodiment, the configuration information includes: the prior bounding box parameters, feature extraction parameters, and category prediction parameters of the attention-based YOLOv5 network.

[0057] Furthermore, the aforementioned feature extraction parameters include: attention module parameters corresponding to the aforementioned attention detection code.

[0058] Step A5: Determine the initial object detection model based on the YOLOv5 network of the attention module configured above.

[0059] In this embodiment, the step of determining the initial object detection model based on the YOLOv5 network with the configured attention module includes: First, adjusting the weights of the bounding box regression loss and the angle classification loss in the loss function of the YOLOv5 network with the configured attention module based on preset weight parameter expressions and preset hyperparameters; and adding a preset feature-based first loss function to the bounding box regression loss to obtain an adjusted second loss function. Then, based on the second loss function, determining the improved YOLOv5 network. Finally, determining the improved YOLOv5 network as the initial object detection model.

[0060] In this embodiment, the present invention classifies it as a theta classification task, so the classification loss consists of three parts: the class classification loss and confidence loss use BCEWithLogitsLoss, while the theta angle classification loss uses VFLLoss. For the bounding box regression loss, the existing YOLOv5 uses CIOU_Loss, while this invention uses DFL (Distribution Focal Loss) + CIOU_Loss. Adding DFL mainly models the box positions as a general distribution, allowing the network to quickly focus on the distribution of positions close to the target position.

[0061] In addition, for rotating target detection, the theta angle has a significant impact on the accuracy of target localization when the target aspect ratio is different. The larger the aspect ratio, the greater the impact of the angle on the accuracy of the target box regression. Therefore, a weight parameter is proposed to reflect this relationship and is used to adjust the weights of the target box regression loss and the angle classification loss.

[0062] Here, the above weight parameters are represented by the following expression:

[0063]

[0064] Where w represents the shorter side of the target bounding box, h represents the longer side of the target bounding box, and μ represents the preset hyperparameter.

[0065] Furthermore, the second loss function described above is expressed by the following formula:

[0066] loss = loss obj +loss box +loss class +βloss θ

[0067] Where, loss obj This represents the confidence loss. box This represents the bounding box regression loss. class This represents the classification loss.

[0068] Step S305: Input the above verification set into the first intermediate detection model for verification until the preset verification end criterion is reached to obtain the second intermediate detection model.

[0069] Step S306: Input the above test set into the second intermediate detection model for verification until the preset test end criterion is reached, and obtain the target detection model based on YOLOv5.

[0070] In one embodiment, after the step of inputting the test set into the second intermediate detection model for verification until a preset test end criterion is reached to obtain the YOLOv5-based target detection model, the method further includes: evaluating the performance of the YOLOv5-based target detection model and determining the average accuracy of the YOLOv5-based target detection model.

[0071] This invention provides a method for constructing a YOLOv5-based target detection model. The YOLOv5-based target detection model is trained using the following steps: acquiring initial VEDAI remote sensing image data; using an image annotation tool to annotate target objects in the initial VEDAI remote sensing image data with rotated bounding boxes, obtaining a preprocessed image carrying annotation information; dividing the preprocessed image into a training set, a validation set, and a test set based on a preset ratio; inputting the training set into the initial target detection model built using a YOLOv5 network for training until a preset training termination criterion is reached, obtaining a first intermediate detection model; inputting the validation set into the first intermediate detection model for validation until a preset validation termination criterion is reached, obtaining a second intermediate detection model; inputting the test set into the second intermediate detection model for validation until a preset test termination criterion is reached, obtaining a YOLOv5-based target detection model. This method obtains a YOLOv5-based target detection model by annotating target objects in the initial VEDAI remote sensing image data with rotated bounding boxes and then training the initial target detection model in groups.

[0072] Example 3

[0073] In this embodiment, Figure 5 This is a schematic diagram of a target detection device based on an improved YOLOv5, provided as an embodiment of the present invention.

[0074] Depend on Figure 5 As seen, the device includes:

[0075] The data acquisition module 51 is used to acquire the remote sensing image to be detected.

[0076] The model detection module 52 is used to input the remote sensing image to be detected into a pre-trained target detection model based on YOLOv5 and output the target detection result of the remote sensing image to be detected; the target detection model based on YOLOv5 is trained using VEDAI remote sensing data annotated with rotated target boxes.

[0077] The target object determination module 53 is used to determine the target object in the remote sensing image to be detected based on the target detection results.

[0078] The data acquisition module 51, the model detection module 52, and the target object determination module 53 are connected in sequence.

[0079] In one embodiment, the model detection module 52 is further configured to acquire initial VEDAI remote sensing image data; use an image annotation tool to annotate the target objects in the initial VEDAI remote sensing image data with rotated bounding boxes to obtain a preprocessed image carrying annotation information; divide the preprocessed image into a training set, a validation set, and a test set based on a preset ratio; input the training set into an initial target detection model built using a YOLOv5 network for training until a preset training end criterion is reached to obtain a first intermediate detection model; input the validation set into the first intermediate detection model for validation until a preset validation end criterion is reached to obtain a second intermediate detection model; input the test set into the second intermediate detection model for validation until a preset test end criterion is reached to obtain a YOLOv5-based target detection model.

[0080] In one embodiment, the model detection module 52 is further configured to acquire a YOLOv5 network; add a target detection layer of a preset size to the YOLOv5 network to obtain an intermediate YOLOv5 network; add preset attention detection code to the function storage file of the intermediate YOLOv5 network, and add a second call instruction of the attention detection code after the first call instruction of the second downsampling in the function call file of the intermediate YOLOv5 network to obtain a YOLOv5 network based on an attention module; set the configuration information of the YOLOv5 network based on the attention module to obtain a configured YOLOv5 network based on the attention module; and determine an initial target detection model based on the configured YOLOv5 network based on the attention module.

[0081] In one embodiment, the model detection module 52 is further configured to adjust the weights of the bounding box regression loss and the angle classification loss in the loss function of the YOLOv5 network of the configured attention module based on a preset weight parameter expression and a preset hyperparameter, and to add a preset feature-based first loss function to the bounding box regression loss to obtain an adjusted second loss function; based on the second loss function, to determine an improved YOLOv5 network; and to determine the improved YOLOv5 network as the initial object detection model.

[0082] In one embodiment, the model detection module 52 is further used to evaluate the performance of the YOLOv5-based target detection model and determine the average accuracy of the YOLOv5-based target detection model.

[0083] The target detection device based on improved YOLOv5 provided in this embodiment of the invention has the same implementation principle and technical effect as the aforementioned target detection method based on improved YOLOv5. For the sake of brevity, any parts not mentioned in the embodiments of the target detection device based on improved YOLOv5 can be referred to the corresponding content in the aforementioned method embodiments.

[0084] This invention also provides an electronic device, such as... Figure 6 The diagram shows the structure of the electronic device, which includes a processor 41 and a memory 42. The memory 42 stores machine-executable instructions that can be executed by the processor 41. The processor 41 executes the machine-executable instructions to implement the target detection method based on the improved YOLOv5 described above.

[0085] exist Figure 6 In the illustrated embodiment, the electronic device further includes a bus 43 and a communication interface 44, wherein the processor 41, the communication interface 44, and the memory 42 are connected via the bus.

[0086] The memory 42 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 44 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus can be an ISA bus, PCI bus, or EISA bus, etc. The aforementioned bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 6 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0087] Processor 41 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 41 or by software instructions. Processor 41 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in the memory. The processor 41 reads the information in the memory 42 and, in conjunction with its hardware, completes the steps of the target detection method based on the improved YOLOv5 in the aforementioned embodiment.

[0088] This invention also provides a machine-readable storage medium storing machine-executable instructions. When these machine-executable instructions are called and executed by a processor, they cause the processor to implement the aforementioned target detection method based on the improved YOLOv5. For specific implementation details, please refer to the foregoing method embodiments, which will not be repeated here.

[0089] The computer program products of the target detection method, target detection device, and electronic device based on the improved YOLOv5 provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the target detection method based on the improved YOLOv5 described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0090] Unless otherwise specifically stated, the relative steps, numerical expressions, and values ​​of the components and steps described in these embodiments do not limit the scope of the invention.

[0091] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0092] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of protection of the above claims.

Claims

1. A target detection method based on an improved YOLOv5, characterized in that, include: Acquire the remote sensing image to be detected; The remote sensing image to be detected is input into a pre-trained YOLOv5-based target detection model, which outputs the target detection result of the remote sensing image to be detected. The YOLOv5-based target detection model is trained using VEDAI remote sensing data annotated with rotated bounding boxes. Based on the target detection results, the target object in the remote sensing image to be detected is determined; The YOLOv5-based object detection model is trained using the following steps: Acquire initial VEDAI remote sensing image data; The target objects in the initial VEDAI remote sensing image data are annotated using rotating bounding boxes using an image annotation tool, resulting in a preprocessed image carrying annotation information; The preprocessed images are divided into a training set, a validation set, and a test set based on a preset ratio. The training set is input into the initial object detection model built with the YOLOv5 network for training until the preset training end criterion is reached, thus obtaining the first intermediate detection model. The verification set is input into the first intermediate detection model for verification until the preset verification end criterion is reached, thus obtaining the second intermediate detection model. The test set is input into the second intermediate detection model for verification until the preset test end criterion is reached, thus obtaining a target detection model based on YOLOv5. The initial target detection model is built through the following steps: Obtain the YOLOv5 network; A target detection layer of a preset size is added to the YOLOv5 network to obtain an intermediate YOLOv5 network; A preset attention detection code is added to the function storage file of the intermediate YOLOv5 network, and a second call instruction of the attention detection code is added after the first call instruction of the second downsampling of the function call file of the intermediate YOLOv5 network to obtain a YOLOv5 network based on the attention module; wherein, the addition of the target detection layer of the preset size specifically means: introducing a new detection head with a resolution of 152×152 at the second downsampling of the intermediate YOLOv5 network; Set the configuration information of the attention module-based YOLOv5 network to obtain the configured attention module-based YOLOv5 network; Based on the configured attention module and YOLOv5 network, determine the initial object detection model; The step of determining the initial object detection model based on the configured attention module's YOLOv5 network includes: Based on the preset weight parameter expression and preset hyperparameters, the weights of the target box regression loss and angle classification loss in the loss function of the YOLOv5 network of the configured attention module are adjusted, and a preset feature-based first loss function is added to the target box regression loss to obtain the adjusted second loss function. Based on the second loss function, an improved YOLOv5 network is determined; The improved YOLOv5 network was selected as the initial object detection model; The weight parameters The expression is: Where w represents the shorter side of the target box, and h represents the longer side of the target box. The hyperparameters are preset; the loss function includes those based on... The adjusted second loss function: ,in, Indicates confidence loss. This represents the bounding box regression loss. Represents classification loss. This represents the angle classification loss.

2. The target detection method based on improved YOLOv5 according to claim 1, characterized in that, The pooling method corresponding to the attention detection code is global max pooling.

3. The target detection method based on improved YOLOv5 according to claim 1, characterized in that, The configuration information includes: the prior bounding box parameters, feature extraction parameters, and category prediction parameters of the attention-based YOLOv5 network.

4. The target detection method based on improved YOLOv5 according to claim 3, characterized in that, The feature extraction parameters include: attention module parameters corresponding to the attention detection code.

5. The target detection method based on improved YOLOv5 according to claim 1, characterized in that, After inputting the test set into the second intermediate detection model for verification until a preset test termination criterion is met, and obtaining the YOLOv5-based object detection model, the method further includes: The performance of the YOLOv5-based target detection model is evaluated to determine its average accuracy.

6. A target detection device based on an improved YOLOv5, characterized in that, The apparatus is applied to the target detection method based on the improved YOLOv5 as described in any one of claims 1-5; the apparatus comprises: The data acquisition module is used to acquire the remote sensing image to be detected; The model detection module is used to input the remote sensing image to be detected into a pre-trained YOLOv5-based target detection model and output the target detection result of the remote sensing image to be detected; the YOLOv5-based target detection model is trained using VEDAI remote sensing data annotated with rotated bounding boxes; The target object determination module is used to determine the target object in the remote sensing image to be detected based on the target detection result.

7. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory storing computer-executable instructions that can be executed by the processor, the processor executing the computer-executable instructions to implement the target detection method based on the improved YOLOv5 as described in any one of claims 1 to 5.