YOLOv8 target detection method based on attention mechanism and multi-scale feature fusion

By improving the Backbone, Neck, and Head of the YOLOv8 model, and combining the CBAM attention mechanism, BiFPN multi-scale feature fusion pyramid, and SIoU loss function, the detection problems of traditional manual inspection and existing algorithms in complex backgrounds are solved, and efficient and accurate identification of insulator faults is achieved.

CN116883801BActive Publication Date: 2025-11-11NORTH CHINA ELECTRIC POWER UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310896292.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-20
Publication Date
2025-11-11
Estimated Expiration
2043-07-20

AI Technical Summary

Technical Problem

Traditional manual inspection methods cannot guarantee the accuracy and safety of insulator detection. Furthermore, existing target detection algorithms have high computational load and slow detection speed in complex backgrounds, making it difficult to effectively identify small target defects.

Method used

A YOLOv8 target detection method based on attention mechanism and multi-scale feature fusion is adopted. By improving the backbone, neck and head of the YOLOv8 model, and combining the CBAM attention mechanism, BiFPN multi-scale feature fusion pyramid and SIoU loss function, the accuracy and efficiency of insulator defect detection are improved.

Benefits of technology

It reduces model complexity, shortens detection time, and improves detection accuracy and robustness, enabling accurate identification of insulator faults in complex field environments and meeting the requirements of unmanned inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116883801B_ABST
    Figure CN116883801B_ABST
Patent Text Reader

Abstract

This invention provides a YOLOv8 target detection method based on an attention mechanism and multi-scale feature fusion. The method includes the following steps: acquiring a dataset of visible light insulator defect images and manually filtering the data; manually labeling the collected image data using the labelimg tool; combining the CBAM attention mechanism, BiFPN multi-scale feature fusion pyramid, SIoU loss function, and the YOLOv8 model to construct a YOLOv8-CBS model; inputting the labeled insulator defect dataset into the YOLOv8-CBS model for training; and using the trained YOLOv8-CBS model to perform fault detection and localization on the visible light insulator defect images to be identified. This invention can be deployed on unmanned inspection equipment. Using unmanned inspection equipment equipped with this invention to detect defects in insulators on transmission lines can significantly improve the accuracy of fault diagnosis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power systems, specifically to a YOLOv8 target detection method based on attention mechanism and multi-scale feature fusion. Background Technology

[0002] Insulators are crucial components of power transmission lines, and their safety and stability are closely related to the reliable power supply of the grid. By the end of 2022, the installation coverage rate of insulators on power transmission lines nationwide had reached nearly 100%, meaning that almost every line had been equipped with insulators. This data indicates that China's insulator installation level is very high, providing a solid guarantee for the safe and stable operation of the power system. However, most insulators are exposed to harsh natural environments in the field for extended periods, making them highly susceptible to failure that is difficult to detect in a timely manner. This places significant pressure on the stable operation of the power system.

[0003] With the accelerated pace of smart grid construction and the continuous expansion of the power system, potential issues related to the safe and stable operation of the power grid are becoming increasingly prominent. Insulators, as one of the most crucial pieces of equipment on overhead transmission lines, play a vital role in the fixed connection and electrical insulation of cables and wires. Therefore, it is essential to regularly monitor the condition of insulators, arrange transmission line inspections, and promptly eliminate insulator faults. Traditional manual inspection methods are difficult to implement due to their high inspection difficulty, lack of safety guarantees, and reliance on human experience, resulting in inconsistent accuracy. With technological advancements, manual inspections are gradually being replaced by intelligent inspection methods such as drones and robots. This has, to some extent, solved the problems of high cost and safety concerns associated with traditional manual inspections. To improve the accuracy of insulator defect detection, it is necessary to design reasonable defect detection methods to further ensure the stable operation of the power system.

[0004] As a crucial method for intelligent inspection of power transmission lines, insulator defect detection algorithms based on target detection have always been a research hotspot in this field. Target detection algorithms are categorized into two types based on the recognition stage. The first type is based on candidate boxes, represented by two-stage target detection algorithms such as Mask R-CNN and Faster R-CNN. Two-stage models suffer from excessive candidate regions and redundant information in adjacent windows, leading to high computational cost and slow detection speed. The second type is based on regression-based end-to-end models, represented by one-stage target detection algorithms such as SSD and YOLO. Starting with the YOLOv1 model, the YOLO series of models has iterated over many years to versions such as YOLOv2, YOLOv3, YOLOv4, and YOLOv5. Summary of the Invention

[0005] The purpose of this invention is to provide a YOLOv8 target detection method based on attention mechanism and multi-scale feature fusion, so as to improve the accuracy of insulator defect detection and deploy it on unmanned inspection equipment.

[0006] This invention is implemented as follows:

[0007] The YOLOv8 target detection method based on attention mechanism and multi-scale feature fusion provided by this invention is an insulator defect detection method based on the YOLO algorithm. This method uses YOLOv8 as the benchmark model and improves the Backbone, Neck and Head ends of the original YOLOv8 model respectively. The insulator defect image is detected on the improved YOLOv8 model. Finally, the effectiveness of this method is verified by experiments.

[0008] This invention adopts the following technical solution: a YOLOv8 object detection method based on attention mechanism and multi-scale feature fusion, comprising the following steps:

[0009] (1) Use unmanned inspection equipment to obtain visible light insulator images, and then manually screen them to obtain an insulator defect image dataset;

[0010] (2) Manually annotate the obtained insulator defect image data using the labelimg tool;

[0011] (3) Combine the CBAM attention mechanism, BiFPN multi-scale feature fusion pyramid, SIoU loss function with the original YOLOv8 model to construct the YOLOv8-CBS model;

[0012] (4) Input the labeled insulator defect image dataset into the YOLOv8-CBS model for training;

[0013] (5) Use the trained YOLOv8-CBS model to detect and locate the visible light insulator defect images to be identified.

[0014] In step (1), the steps for obtaining the visible light insulator image are as follows:

[0015] Unmanned inspection equipment was used to collect visible light images of insulators on power transmission lines in the field. Sufficient lighting conditions were required when taking the images, and obstructions to the target insulators should be minimized. After acquiring the images, they were manually filtered to remove images of intact insulators, retaining only images of defective insulators.

[0016] The specific operation steps in step (2) are as follows:

[0017] The manually selected images were labeled using the labelimg annotation tool in YOLO format. For insulators that were damaged or spontaneously exploded, the entire insulator segment was labeled with the tag "broken"; for insulators that experienced flashover, only the area on the insulator segment where the flashover fault occurred was labeled with the tag "flashover". The label names and locations were saved in a .txt file. After completing the annotation, the dataset was randomly divided into training and validation sets in an 8:2 ratio.

[0018] The specific operation steps in step (3) are as follows:

[0019] A YOLOv8-CBS model is constructed by combining the CBAM attention mechanism on the backbone, the BiFPN multi-scale feature fusion pyramid on the neck, and the SIoU loss function on the head. The specific steps are as follows:

[0020] 1) Integrating the CBAM attention mechanism into the backbone: Although the YOLOv8 model's backbone network has strong feature extraction capabilities, in natural field environments, aerial images of insulators are easily affected by factors such as lighting, occlusion, complex backgrounds, and the small area of ​​defective regions on the insulators, making image recognition difficult. Considering that the spatial features of the input image are significantly weakened after the ninth layer of feature extraction, this invention integrates the CBAM attention mechanism between the fourth C2f module and the SPPF module of the YOLOv8 backbone feature extraction network to solve the above problems.

[0021] The CBAM attention mechanism is implemented by the CBAM attention mechanism module. The CBAM attention mechanism module, or Convolutional Block Attention Module, includes the CAM channel attention module and the SAM spatial attention module. In the CAM channel attention module, the feature map maintains its channel dimension while compressing its spatial dimension, allowing the model to focus more on the image's category information. In the SAM spatial attention module, the feature map maintains its spatial dimension while compressing its channel dimension, allowing the model to focus more on the image's positional information. The CAM channel attention module specifically performs the following steps: First, the input feature map is subjected to global max pooling and global average pooling, reducing the feature map size from W*H*C to 1*1*C. These two feature maps are then input into a shared MLP, processed by the ReLU activation function to obtain two activated results. Finally, the two outputs of the shared MLP are added, passed through a sigmoid function, and multiplied by the original input feature map to restore the image size to W*H*C. The SAM spatial attention module performs the following steps: First, it performs global max pooling and global average pooling on the channel feature maps to obtain two W*H*1 feature maps. Then, it performs a concat operation on these two feature maps and then reduces the dimensionality to a single-channel feature map through a convolutional layer with a kernel size of 7*7. Finally, it passes through the sigmoid function and is multiplied by the input feature map to make the image size return to W*H*C, thus obtaining the output feature map of the CBAM attention mechanism module.

[0022] 2) Combining BiFPN multi-scale feature fusion pyramid at the Neck end: In actual inspection scenarios, due to problems such as shooting angle, shadow occlusion, and insufficient lighting conditions, the image quality of insulator defects may be poor. For such images, the YOLOv8 model cannot extract meaningful features, the feature fusion effect is poor, and it may even affect the learning ability of the model. Therefore, BiFPN structure is used for multi-scale feature fusion. Fast Normalized Fusion is used for weighted fusion during the feature fusion process. The weighted calculation method (taking the 6th layer node as an example) is shown in formula (1). According to the definition of BiFPN network structure, the weighted feature fusion is added at layers 12, 15, 18, and 21. At the same time, the feature maps after the 7th layer are connected with BiFPN_Concat of the 18th layer. The BiFPN structure removes nodes with single input edges and adds connections between input and output nodes in the same layer. Since nodes with only one input edge do not perform feature fusion and contribute little to the feature fusion network, their removal has little impact on the feature fusion effect. At the same time, removing nodes with single input edges simplifies the network structure, reduces computation, and retains the unfused information of the original nodes.

[0023]

[0024] in, The input features are for the input nodes of the 6th layer. The output features of the intermediate nodes in the 6th layer, The output features of the 6th layer output node, The output features of the 5th layer output node The input features are the input features of the 7th layer input node, Conv is the convolution operation, resize is the upsampling or downsampling operation, and ω is the input feature. i (i = 1, 2) and ω i '(i=1,2,3) are weight parameters that distinguish the importance of different features, and ε is the bias term.

[0025] 3) Incorporating SIoU Loss Function at the Head End: In the original YOLOv8 model, when the height and width of the predicted bounding boxes are proportionally scaled up or down during regression, the regression cannot continue to optimize. Furthermore, it does not consider that the angle between the predicted and ground truth bounding boxes is also a significant factor affecting regression. Based on these two considerations, this invention uses SIoU as the loss function in the predicted bounding box regression stage. The SIoU loss function includes four parts: angle loss, distance loss, shape loss, and intersection-union ratio (IU). Using SIoU as the loss function in the predicted bounding box regression process can fully consider the angle influence between the predicted and ground truth bounding boxes, improve the model's convergence speed and regression accuracy, and make the entire regression process focus more on high-quality anchor boxes.

[0026] The specific operation steps of step (4) are as follows:

[0027] The labeled insulator defect image dataset is input into the YOLOv8-CBS model for training, resulting in the YOLOv8-CBS.pt weight file.

[0028] The YOLOv8-CBS model consists of a Backbone, a Neck, and a Head. The Backbone performs feature extraction, the Neck performs feature fusion, and the Head performs prediction. The Backbone includes a CBS module, a C2f module, a CBAM attention mechanism module, and a SPPF module. The CBS module consists of convolutional layers, normalization layers, and SiLU activation function layers. The C2f module consists of a CBS module, a split layer, and multiple Bottleneck layers. The CBAM attention mechanism module consists of a CAM channel attention module and a SAM spatial attention module. The Backbone, incorporating the CBAM attention mechanism, enhances the learning of features in image defect regions such as insulator defects, spontaneous explosions, and flashovers, improving target detection accuracy and enhancing the model's generalization ability. The Neck includes a CBS module, a C2f module, an Upsample layer, and a BiFPN_Concat module. The Upsample layer performs upsampling operations to facilitate feature fusion. By incorporating a BiFPN structure into the Neck layer for multi-scale feature fusion, the YOLOv8-CBS model can improve its accuracy in detecting small objects while reducing network complexity and redundant computation. The Head layer employs a decoupled head structure and incorporates the SIoU loss function, which fully considers the angular influence between the predicted and ground truth boxes, improving the model's convergence speed and regression accuracy, and focusing more on high-quality anchor boxes throughout the regression process.

[0029] The specific steps for step (5) are as follows:

[0030] The trained YOLOv8-CBS model is used to detect and locate defects in visible light insulators, enabling timely repair of the transmission lines where the faulty insulators are located.

[0031] The technical solution provided by this invention has the following beneficial effects:

[0032] This invention analyzes potential problems in actual inspection scenarios and proposes an improved YOLOv8 insulator defect detection method by combining attention mechanisms and multi-scale feature fusion. Compared with the YOLOv5 model, this method reduces model complexity and shortens detection time; compared with the original YOLOv8 model, it improves detection accuracy and demonstrates good overall performance. The specific conclusions are as follows: To address the issue of complex outdoor natural environments where insulator defect images are easily affected by lighting and complex backgrounds, a CBAM attention mechanism was integrated into the backbone feature extraction network. This effectively reduced the impact of complex backgrounds on detection accuracy. The unique channel and spatial attention modules of the CBAM attention mechanism effectively improved the detection of small targets and targets in complex backgrounds during insulator fault identification. To address the problem of complex network structure and poor feature fusion performance in the YOLOv8 model's neck, a multi-scale feature fusion approach using a BiFPN structure was adopted. This fully considered the importance of different feature maps in the feature fusion process. Using a weighted fusion method significantly improved the model's feature fusion capability for targets of different scales, especially small targets. To solve the problem that the predicted bounding box cannot be further optimized due to the simultaneous proportional growth of length and width during regression, the SIoU loss function was combined with the YOLOv8 model's head. This allows for greater attention to high-quality anchor boxes during regression, accelerating model convergence and further improving the model's robustness and generalization. Experimental verification shows that the application of the YOLOv8-CBS model proposed in this invention can identify insulator faults in a timely and accurate manner, reduce model complexity while improving fault identification accuracy, and is of great significance for the detection of insulator faults in power transmission and distribution networks and the safe operation of power transmission and distribution networks. Attached Figure Description

[0033] Figure 1 This is a flowchart of the method of the present invention.

[0034] Figure 2 This is a schematic diagram of the YOLOv8-CBS model structure of the present invention.

[0035] Figure 3 This is a schematic diagram of the data annotation method in an embodiment of the present invention.

[0036] Figure 4 This is a schematic diagram of the CBAM attention mechanism module structure.

[0037] Figure 5 This is a schematic diagram of the BiFPN structure.

[0038] Figure 6 This is a schematic diagram of the decoupling head structure.

[0039] Figure 7This is a comparison chart of the detection results of the YOLOv8 model and the YOLOv8-CBS model. Detailed Implementation

[0040] To enable those skilled in the art to better understand the purpose, technical solution, and technical effects of the present invention, the technical solution of the present invention will be clearly and completely described below in conjunction with specific embodiments. However, the invention is not limited thereto. All aspects not described in detail in the present invention are based on conventional techniques in the field.

[0041] like Figure 1 As shown, Figure 1 The process for completing the insulator defect detection according to the present invention includes the following detailed steps.

[0042] Step (1): Collect visible light images of insulator defects.

[0043] Unmanned inspection equipment was used to collect visible light images of insulators on power transmission lines in the field. Sufficient lighting conditions were required when capturing these images, and obstructions to the target insulators should be minimized. After acquisition, images of intact insulators were manually filtered out, retaining only those with defects. Defects in the insulator images included breakage, spontaneous explosion, and flashover faults. Breakage and spontaneous explosion were classified as "broken," and flashover was classified as "flashover."

[0044] Step (2) involves manually labeling the collected images and dividing them into training and validation sets.

[0045] The labelimg tool, using YOLO format, was used to annotate the manually selected images. For insulators that were damaged or spontaneously exploded, the entire insulator disc was labeled "broken"; for insulators that experienced flashover, only the area on the insulator disc where the flashover fault occurred was labeled "flashover". The specific data annotation method is shown in the attached figure. Figure 3 As shown, Figure 3 In the image, the top left corner shows a damaged insulator, and the entire insulator segment is labeled; the bottom left corner shows a spontaneously exploded insulator, and the entire insulator segment is labeled; the insulators in the top right and bottom right corners show flashover faults, so the areas where flashover faults occurred are labeled. After labeling, the label names and locations are saved in a .txt file. After completing the labeling, a Python script is used to randomly divide the dataset into training and validation sets at an 8:2 ratio.

[0046] Step (3): Construct the YOLOv8-CBS model.

[0047] A YOLOv8-CBS model is constructed by combining the CBAM attention mechanism on the backbone, the BiFPN multi-scale feature fusion pyramid on the neck, and the SIoU loss function on the head. The specific steps are as follows:

[0048] The YOLOv8 model (or the original YOLOv8 model) includes a Backbone, Neck, and Head component. The Backbone is used for feature extraction, the Neck for feature fusion, and the Head for prediction. The constructed YOLOv8-CBS model is identical to the YOLOv8 model, also including a Backbone, Neck, and Head component. The Backbone performs feature extraction, the Neck performs feature fusion, and the Head performs prediction. Combined with... Figure 2 The Backbone side runs from the first CBS module after input to the SPPF module (including the SPPF module), the Neck side runs from the SPPF module to the C2f module after each BiFPN_Concat module (including the C2f module), and the Head side only has three Detect modules.

[0049] 1) Integrate the CBAM attention mechanism on the Backbone side.

[0050] Although the backbone network of the YOLOv8 model has strong feature extraction capabilities, aerial images of insulators in natural outdoor environments are easily affected by factors such as lighting, occlusion, complex backgrounds, and small areas where defects occur on the insulators, making the images difficult to identify.

[0051] The backbone of the YOLOv8 model includes, in sequence: CBS module, CBS module, C2f module, CBS module, C2f module, CBS module, C2f module, CBS module, C2f module, C2f module, and SPPF module. Considering that the spatial features of the input image are significantly weakened after the ninth layer of feature extraction, this invention integrates the CBAM attention mechanism between the fourth C2f module and the SPPF module of the YOLOv8 backbone feature extraction network to address this problem. Figure 2 As shown. The CBAM attention mechanism is implemented by the CBAM attention mechanism module, whose structure is as follows. Figure 4 As shown.

[0052] The CBAM attention mechanism module, or Convolutional Block Attention Module, includes the CAM channel attention module and the SAM spatial attention module. In the CAM channel attention module, the feature map maintains its channel dimension while compressing its spatial dimension, allowing the model to focus more on the image's category information. In the SAM spatial attention module, the feature map maintains its spatial dimension while compressing its channel dimension, allowing the model to focus more on the image's positional information. The CAM channel attention module specifically performs the following steps: First, the input feature map is subjected to global max pooling and global average pooling, reducing the feature map size from W*H*C to 1*1*C. These two feature maps are then input into a shared MLP, passing through the ReLU activation function to obtain two activated results. Finally, the two outputs of the shared MLP are added, passed through the sigmoid function, and multiplied by the original input feature map to restore the image size to W*H*C. The SAM spatial attention module performs the following steps: First, it performs global max pooling and global average pooling on the channel feature maps to obtain two W*H*1 feature maps. Then, it performs a concat operation on these two feature maps and then reduces the dimensionality to a single-channel feature map through a convolutional layer with a kernel size of 7*7. Finally, it passes through the sigmoid function and is multiplied by the input feature map to make the image size return to W*H*C, thus obtaining the output feature map of the CBAM attention mechanism module.

[0053] 2) Combine BiFPN multi-scale feature fusion pyramid at the Neck end.

[0054] BiFPN structure as follows Figure 5 As shown, a BiFPN structure is used for multi-scale feature fusion. Fast Normalized Fusion is used for weighted fusion during the feature fusion process. The weighted calculation method (taking the 6th layer node as an example) is shown in formula (1). Figure 2 According to the definition of the BiFPN network structure, weighted feature fusion is added at layers 12, 15, 18, and 21. Simultaneously, the feature maps from layer 7 onwards are connected to the BiFPN_Concat layer at layer 18. The BiFPN structure removes nodes with single-input edges and adds connections between input and output nodes within the same layer. Since nodes with only one input edge do not participate in feature fusion and contribute little to the feature fusion network, their removal has minimal impact on the feature fusion effect. Furthermore, removing single-input edge nodes simplifies the network structure, reduces computational cost, and preserves the unfused information from the original nodes.

[0055]

[0056] in, The input features are for the input nodes of the 6th layer. The output features of the intermediate nodes in the 6th layer, The output features of the 6th layer output node, The output features of the 5th layer output node The input features are the input features of the 7th layer input node. Conv is the convolution operation, resize is the upsampling or downsampling operation, and ω is the input feature. i (i = 1, 2) and ω i '(i=1,2,3) are weight parameters that distinguish the importance of different features, and ε is the bias term.

[0057] 3) Incorporate the SIoU loss function at the Head end.

[0058] In the original YOLOv8 model, the regression of predicted bounding boxes fails to optimize further when the height and width of the predicted boxes are proportionally scaled up or down. Furthermore, it doesn't consider the angle between the predicted and ground truth bounding boxes, which is also a significant factor affecting regression. Based on these two considerations, we propose using SIoU as the loss function in the predicted bounding box regression stage. SIoU comprises four parts: angle loss, distance loss, shape loss, and intersection-over-union (IoU) loss. Using SIoU as the loss function in the predicted bounding box regression process fully considers the angular influence between the predicted and ground truth bounding boxes, improving the model's convergence speed and regression accuracy, and focusing more on high-quality anchor boxes throughout the regression process.

[0059] The YOLOv8-CBS model structure is as follows: Figure 2 As shown in the figure, it is clearly indicated that the CBAM attention mechanism module should be added between the fourth C2f module and the SPPF module, and all feature fusion operations should be BiFPN_Concat weighted fusion.

[0060] In the YOLOv8-CBS model, the backbone consists of the following modules in sequence: CBS, C2f, CBS, C2f, CBS, C2f, CBS, C2f, CBS, C2f, CBAM attention mechanism module, and SPPF module. The CBS module comprises convolutional layers, normalization layers, and SiLU activation function layers; the C2f module consists of the CBS module, split layers, and multiple Bottleneck layers; and the CBAM attention mechanism module consists of CAM channel attention modules and SAM spatial attention modules. The backbone, incorporating the CBAM attention mechanism, enhances the learning of image defect features such as insulator defects, spontaneous explosions, and flashovers, improving target detection accuracy and enhancing the model's generalization ability. The neck includes an Upsample layer, a BiFPN_Concat module, a C2f module, and a CBS module. The Upsample layer performs upsampling operations to facilitate feature fusion. In the original YOLOv8 model, layers 12, 15, 18, and 21 are Concat modules. In the YOLOv8-CBS model, due to the integration of a BiFPN structure, the corresponding module is named BiFPN_Concat. The Neck end, incorporating a BiFPN structure, performs multi-scale feature fusion, which improves the accuracy of the YOLOv8-CBS model in detecting small objects while reducing network complexity and redundant computation. The Head end employs a decoupled head structure and incorporates the SIoU loss function, fully considering the angular influence between the predicted and ground truth boxes, improving the model's convergence speed and regression accuracy, and focusing more on high-quality anchor boxes throughout the regression process. Figure 6 As shown, the decoupled head structure includes a CBS module, convolutional layers, and regression and classification loss functions.

[0061] Step (4): Train the YOLOv8-CBS model.

[0062] The training set from the labeled insulator defect dataset is input into the YOLOv8-CBS model for training, resulting in the YOLOv8-CBS.pt weight file, which in turn generates the YOLOv8-CBS model. After training, the model is validated using a validation set.

[0063] Step (5): Use the YOLOv8-CBS model to identify faulty insulators.

[0064] The trained YOLOv8-CBS model is used to detect and locate defects in visible light insulators in the images to be identified, and to repair the transmission lines where the faulty insulators are located in a timely manner.

[0065] The YOLOv8 model and the YOLOv8-CBS model were used for detection on the same dataset, and the comparison results are as follows: Figure 7 As shown. From Figure 7 It can be seen that compared to the YOLOv8 model, the YOLOv8-CBS model has stronger feature extraction capabilities, performs better in distinguishing similar features, achieves more thorough multi-scale feature fusion, is more effective in detecting small targets, and has lower false negative and false positive rates. It also demonstrates good detection performance even in complex natural environments, exhibiting good robustness and generalization, thus meeting the requirements of unmanned inspection.

[0066] The framework used in this embodiment is PyTorch 1.13, Python version is 3.9, CUDA version is 11.7, the training system is Windows 10, and the graphics card used for training is a GeForce 2060 6GB.

[0067] In summary, this invention uses an improved YOLOv8 model for insulator defect detection in transmission lines, which improves the accuracy of insulator defect detection. This is crucial for ensuring the safe and stable operation of the power grid.

Claims

1. A YOLOv8 object detection method based on attention mechanism and multi-scale feature fusion, characterized in that, Includes the following steps: (1) Use unmanned inspection equipment to obtain visible light insulator images, and then manually screen them to obtain an insulator defect image dataset; (2) Manually annotate the obtained insulator defect image data using the labelimg tool; (3) Combine the CBAM attention mechanism, BiFPN multi-scale feature fusion pyramid, SIoU loss function with the original YOLOv8 model to construct the YOLOv8-CBS model; (4) Input the labeled insulator defect image dataset into the YOLOv8-CBS model for training; (5) Use the trained YOLOv8-CBS model to detect and locate the visible light insulator defects in the images to be identified; Step (3) specifically involves: combining the CBAM attention mechanism at the Backbone end of the YOLOv8 model, combining the BiFPN multi-scale feature fusion pyramid at the Neck end, and combining the SIoU loss function at the Head end to construct the YOLOv8-CBS model; The CBAM attention mechanism is integrated into the backbone of the YOLOv8 model. Specifically, the CBAM attention mechanism module is fused between the fourth C2f module and the SPPF module of the YOLOv8 model. The CBAM attention mechanism module includes the CAM channel attention module and the SAM spatial attention module. In the CAM channel attention module, the feature map retains the channel dimension unchanged and compresses the spatial dimension. In the SAM spatial attention module, the feature map retains the spatial dimension unchanged and compresses the channel dimension.

2. The YOLOv8 target detection method based on attention mechanism and multi-scale feature fusion as described in claim 1, characterized in that, Step (2) is as follows: Use the labelimg annotation tool to select YOLO format to annotate the manually selected images: For insulators that have been damaged or exploded, annotate the entire insulator piece and label it as broken; For insulators that have flashed over, only annotate the area on the insulator piece where the flashover fault occurred and label it as flashover; Store the label name and location, and then randomly divide the dataset into training set and validation set in a ratio of 8:

2.

3. The YOLOv8 target detection method based on attention mechanism and multi-scale feature fusion as described in claim 1, characterized in that, The Neck layer incorporates a BiFPN multi-scale feature fusion pyramid. Specifically, a BiFPN structure is used at the Neck layer for multi-scale feature fusion. The process employs Fast Normalized Fusion for weighted fusion, and BiFPN features are added at layers 12, 15, 18, and 21.

4. The YOLOv8 target detection method based on attention mechanism and multi-scale feature fusion as described in claim 3, characterized in that, For the 6th layer node, the weighted calculation method is shown in formula (1). (1) The weighted calculation method for nodes in other layers is shown above; In equation (1), The input features are for the input nodes of the 6th layer. The output features of the intermediate nodes in the 6th layer, The output features of the 6th layer output node, The output features of the 5th layer output node The input features are for the input nodes of the 7th layer. For convolution operations, For upsampling or downsampling operations, ω1, ω2, ω1', ω2', and ω3' are weight parameters. This is a bias term.

5. The YOLOv8 target detection method based on attention mechanism and multi-scale feature fusion according to claim 1, characterized in that, The SIoU loss function comprises four parts: angle loss, distance loss, shape loss, and crossover ratio loss.

6. The YOLOv8 target detection method based on attention mechanism and multi-scale feature fusion as described in claim 1, characterized in that, The YOLOv8-CBS model consists of a Backbone, a Neck, and a Head. The Backbone performs feature extraction, the Neck performs feature fusion, and the Head performs prediction. The Backbone includes a CBS module, a C2f module, a CBAM attention mechanism module, and a SPPF module. The CBS module consists of convolutional layers, normalization layers, and SiLU activation function layers. The C2f module consists of a CBS module, a split layer, and several Bottleneck layers. The CBAM attention mechanism module consists of a CAM channel attention module and a SAM spatial attention module. The Neck includes a CBS module, a C2f module, an Upsample layer, and a BiFPN_Concat module, where the Upsample layer performs upsampling. The Head uses a decoupled head structure and incorporates the SIoU loss function.

7. The YOLOv8 target detection method based on attention mechanism and multi-scale feature fusion according to claim 1, characterized in that, Step (4) specifically involves inputting the labeled insulator defect image dataset into the YOLOv8-CBS model for training, and obtaining the YOLOv8-CBS.pt weight file.

Citation Information

Patent Citations

  • Insulator damage detection method based on improved yolov5 algorithm

    CN113920107A

  • Improved yolov5-based aerial insulator orientation identification method

    CN115690542A