Power transmission line insulator defect detection method based on improved YOLOv8n
By improving the YOLOv8n model, the introduction of multi-branch Transformer Block, semantic guidance module and dynamic downsampling module is solved, and the multi-scale changes and small scales of the insulator defect image of transmission line are achieved, achieving efficient and accurate defect detection.
Patent Information
- Application Number
- CN202411687323.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-03-21
AI Technical Summary
The existing YOLO model has failed to effectively deal with the multi-scale changes and small scale characteristics of the insulator defect images of transmission line, making it difficult to accurately detect defects in complex backgrounds.
By improving the YOLOv8n model, the MBPTB module, MBCGM module and DyDown module are introduced to enhance the modeling ability of the backbone network to promote the interaction between features at different levels, and retain detailed information through dynamic convolution.
High-precision detection of insulator defects in transmission lines is realized, detection efficiency is improved, information loss can be effectively prevented, model parameters are significantly reduced, and application needs of transmission lines patrol are met.
Smart Images

Figure CN119671951A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of target detection, and specifically is a method for detecting defects in insulators of a transmission line based on improved YOLOv8n. Background Art
[0002] Transmission lines are bridges connecting power stations and power loads in power systems. Their safety directly affects the transmission of electric energy. Insulators, as an important component of transmission lines, isolate the conductors of transmission lines from supporting structures such as poles and towers to prevent current from flowing through these non-conductive parts to the ground or other parts that should not be energized, thereby avoiding accidents such as short circuits and leakage. However, since insulators are in a complex and changeable natural environment for a long time, these climatic conditions will directly affect the electrical performance and mechanical strength of the insulators. Therefore, accurate and timely detection of the insulator status is particularly important to ensure the safety and stability of power supply.
[0003] The traditional method of transmission line inspection mainly relies on manual inspection, which requires a lot of manpower and material resources, and has a long inspection cycle, making it difficult to discover and solve problems in a timely manner; in addition, when inspecting, due to factors such as height and viewing angle, it is difficult for inspectors to fully and accurately observe every detail of the transmission line. With the popularization of deep learning technology in target detection, it is expected that insulator defects can be detected efficiently and accurately through deep learning technology.
[0004] The target detection methods based on deep learning can be roughly divided into two types: one is a two-stage detector represented by Faster R-CNN, and the other is a single-stage detector represented by the YOLO series and the SSD series. At present, the detection accuracy and inference speed of the two-stage detector are generally not as good as those of the one-stage detector. In comparison, YOLO has the advantages of real-time performance and high accuracy, which is more in line with the requirements of transmission line inspection. However, the existing YOLO model does not consider the particularity of the transmission line insulator defect image, and it is difficult to cope with the multi-scale changes and small scale characteristics of the transmission line insulator defect. Therefore, it is necessary to improve its structure to be suitable for transmission line insulator defect detection, thereby saving manpower and financial resources to meet the application needs of transmission line inspection. Summary of the invention
[0005] In view of the shortcomings of the prior art, the purpose of the present invention is to provide a transmission line insulator defect detection method based on improved YOLOv8n, which can accurately detect insulator defects, has high detection efficiency, achieves a balance between detection accuracy and reasoning speed, and can meet the application requirements of transmission line inspection.
[0006] In order to achieve the above object, the present invention adopts the following technical solutions:
[0007] A method for detecting defects in insulators of transmission lines based on improved YOLOv8n comprises the following steps:
[0008] Step 1: Obtain a transmission line insulator defect dataset and divide it into a training set, a validation set, and a test set;
[0009] Step 2: Build a transmission line insulator defect detection model based on improved YOLOv8n. The specific process is as follows:
[0010] Step 2.1, first replace the MLP module in the MHSA module with the CGLU module to obtain the MHSA-CGLU module, combine the MHSA-CGLU module and the Bottleneck module to form the PTB module, then replace the DenseBlock in the original CSP module with the PTB module to obtain the MBPTB module. The MBPTB module includes a left branch and a right branch. The left branch is an identity mapping module, and the right branch includes 6 PTB modules. Then, the MBPTB module is used to replace the deepest C2f module in the backbone network of the original YOLOv8n model to enhance the backbone network's modeling ability for global features and reduce the number of parameters of the backbone network.
[0011] Step 2.2, first use CGblock to replace Bottleneck in the C2f module with CGBlock to obtain the MBCGM module, and then use the MBCGM module to replace the C2f module at the detection head position in the neck network of the original YOLOv8n model, so as to promote the interaction between features at different levels and achieve efficient fusion between global features and detail features;
[0012] Step 2.3: First replace the convolution module in ADown with dynamic convolution to obtain the DyDown module, and then use the DyDown module to replace the downsampling modules of the third and fifth layers in the original YOLOv8n model backbone network, thereby solving the problem of detail information loss during the encoding process;
[0013] Step 3: first set the parameters, then use the training set to train the transmission line insulator defect detection model based on the improved YOLOv8n, and use the validation set to tune the hyperparameters of the transmission line insulator defect detection model based on the improved YOLOv8n during the training process to obtain the optimal transmission line insulator defect detection model based on the improved YOLOv8n;
[0014] Step 4: Input the transmission line insulator defect image to be detected into the optimal transmission line insulator defect detection model based on improved YOLOv8n, and output the detection result.
[0015] Furthermore, the data set of step 1 includes 9 types of defects, namely: dirty glass, missing glass, polymer, dirty polymer, two pieces of glass, broken disk, insulator, flashover pollution and snow.
[0016] Furthermore, the step 1 divides the transmission line insulator defect dataset into a training set, a validation set and a test set according to the sample size of 8:1:1.
[0017] Furthermore, the processing process of the input features by the MBPTB module in step 2 is as follows:
[0018] Step 2.1.1, use 1×1 convolution to fuse the feature map of the input MBPTB module to obtain the fused feature map, and then divide the fused feature map into two parts. One part of the feature map is used as the input feature map of the left branch and is directly transmitted to the Concat module. The other part of the feature map is used as the input feature map of the right branch and is passed through 6 PTB modules for multiple averaging operations. That is, each time it passes through a PTB module, it will be evenly divided. The two parts of the feature map generated by the averaging operation are respectively input into the MHSA-CGLU module and the Bottleneck module, and then the feature maps output by the MHSA-CGLU module and the Bottleneck module are fused using 1×1 convolution as the output feature map of the PTB module;
[0019] Step 2.1.2: Concatenate the input feature map of the right branch, the input feature map of the left branch, and the output feature map of each PTB module, and then use 1×1 convolution to perform feature fusion on the concatenated feature maps.
[0020] Furthermore, the processing process of the input feature map by the Bottleneck module in step 2.1.1 is as follows: the feature map input to the Bottleneck module is processed by two CBS modules in sequence, and then the feature map output by the last CBS module is added to the feature map input to the Bottleneck module to obtain the output feature map of the Bottleneck module.
[0021] Furthermore, the processing process of the input feature map by the MHSA-CGLU module in step 2.1.1 is as follows: the feature map input to the MHSA-CGLU module passes through the cascaded LayerNorm2d module, MHSA module and DropPatch module in sequence to obtain feature map K1, the feature map K1 is added to the feature map of the input MHSA-CGLU module to obtain feature map K2, the feature map K2 passes through the cascaded LayerNorm2d module, CGLU module and DropPatch module in sequence to obtain feature map K3, the feature map K2 and the feature map K3 are added to obtain the output feature map of the MHSA-CGLU module.
[0022] Furthermore, the processing process of the CGLU module on the input feature map is as follows: the feature map of the input CGLU module is divided into two parts in the channel dimension, one part passes through the left branch composed of a cascaded linear layer, a 3×3 deep convolution module and an Activation module in sequence, and the other part passes through the right branch composed of a linear layer, and the feature maps output by the left branch and the right branch are multiplied element by element to obtain the feature map L1. After the feature map L1 is processed by a linear layer, it is added to the feature map of the input CGLU module to obtain the output feature map of the CGLU module.
[0023] Furthermore, the processing process of the MBCGM module in step 2 on the input feature map is as follows:
[0024] Step 2.2.1, first transform the input feature map through the first 1×1 convolutional layer to generate an intermediate feature map, thereby enhancing the feature expression ability of the model, and then split the intermediate feature map into two parts, one part is directly passed to the final Concat module to retain the original feature information; the other part is directly passed to the CGBlock module to extract deeper features;
[0025] Step 2.2.2: First, the feature map input to the CGBlock module is transformed using a 1×1 convolution module, and then input into a 3×3 convolution module and a 3×3 dilated convolution module, so that the CGBlock module learns the features of the defect itself and the surrounding environment from the input feature map. Then, the feature maps output by the 3×3 convolution module and the 3×3 dilated convolution module are concatenated by Concat, processed by BN and SiLU in turn, and then transmitted to the Fusion component, which refines the joint features of the local features and the surrounding context information.
[0026] Step 2.2.3, concatenate the feature map processed by the CGBlock module with the feature map directly passed to the Concat module to form a fused feature map, which increases the diversity of features and helps the model to better aggregate multi-scale information;
[0027] Step 2.2.4: Process the fused feature map through the second 1×1 convolutional layer to compress the number of channels to the required number of output channels, and finally output the feature map of the MBCGM module.
[0028] Furthermore, the processing process of the DyDown module in step 2 on the input features is as follows:
[0029] Step 2.3.1. First, perform the AvgPool2d operation on the feature map input to the DyDown module to average multiple adjacent feature values to capture the overall statistical characteristics of these feature values rather than specific details. This aggregation helps the model focus more on global features.
[0030] Step 2.3.2, first divide the feature map processed by the AvgPool2d operation into two parts, and input them into the left branch and the right branch respectively, where: the left branch contains a dynamic convolution layer, and the right branch contains the MaxPool2d layer and the dynamic convolution layer. The MaxPool2d layer helps the DyDown module to focus more on the key parts of the input features and suppress the interference of irrelevant information. The dynamic convolution can dynamically generate convolution kernels according to the different scales of defects, thereby responding accordingly to defects of different scales. Then, the output feature maps of the left branch and the right branch are spliced to obtain the output feature map of the DyDown module.
[0031] Furthermore, the process of setting parameters in step 3 is as follows: batch-size is set to 8, initial learning rate is set to 0.001, weight decay parameter is set to 0.0005, momentum factor is set to 0.937; Adam optimizer is used, number of iterations is set to 200, and learning rate decay strategy adopts cosine annealing algorithm.
[0032] Compared with the prior art, the present invention has the following technical effects:
[0033] Based on the original YOLOv8n model, the present invention improves it and can cope with the problems of multi-scale variation diversity, small scale and complex background of transmission line insulator defects, effectively prevent information loss, improve the detection accuracy and efficiency of insulator defect image defects, and meet the application requirements of transmission line inspection, which is specifically embodied in: 1) the introduced MBPTB distributes the input feature map to the multi-branch Transformer Blcok and CNN models in proportion, thereby improving the ability of the network model to learn global features and local features; 2) the multi-branch structure of the introduced MBCGM can simultaneously learn the features of the defect itself and the features of the surrounding environment, extract rich high-level semantic information, and thus enhance the model's ability to focus on the target in a complex background; 3) the introduced dynamic downsampling module DyDown can retain the fine-grained information of the image to the greatest extent while reducing the image resolution, thereby enhancing the detector's ability to detect small-scale defects, significantly reducing the amount of model parameters, achieving model lightweight, and improving the recall rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 It is the distribution diagram of 9 defects in the Insulator-DET data set of the present invention;
[0035] Figure 2 It is a structural diagram of the transmission line insulator defect detection model based on improved YOLOv8n of the present invention;
[0036] Figure 3 It is a structural schematic diagram of the MBPTB module in the present invention;
[0037] Figure 4 It is a structural schematic diagram of the MBCGM module in the present invention;
[0038] Figure 5 It is a structural diagram of the DyDown module in the present invention;
[0039] Figure 6 These are some test results of the present invention on the test set. DETAILED DESCRIPTION
[0040] The specific contents of the present invention are further explained in detail below in conjunction with embodiments.
[0041] A method for detecting defects in insulators of transmission lines based on improved YOLOv8n comprises the following steps:
[0042] Step 1: Obtain a transmission line insulator defect dataset and divide it into a training set, a validation set, and a test set;
[0043] The transmission line insulator defect dataset is the Insulator-DET dataset built by the inventor team, such as Figure 1 As shown in the figure, there are 9 defects in total, namely, glass dirty, glass loss, polymer, polymer dirty, two glass, broken disc, insulator, pollution-flashover and snow. The data set is divided into training set, validation set and test set according to the sample number ratio of 8:1:1.
[0044] Step 2: Build Figure 2 The transmission line insulator defect detection model based on improved YOLOv8n shown in FIG. 1 is as follows:
[0045] Step 2.1: First replace the MLP module in the MHSA module with the CGLU module to obtain the MHSA-CGLU module, combine the MHSA-CGLU module and the Bottleneck' module to form the PTB module, and then replace the DenseBlock in the original cross-stage local network CSP module with the PTB module (i.e., the local Transformer Block module), and obtain Figure 3 The MBPTB module shown in the figure includes a left branch and a right branch. The left branch is an identity mapping module, and the right branch includes 6 PTB modules. Then, the MBPTB module is used to replace the deepest C2f module in the backbone network of the original YOLOv8n model. MBPTB aims to fully interact with the rich detail information contained in the CSP multi-branch structure and the global information contained in the PTB module, thereby improving the network's perception of small-scale defects in complex scenes, thereby enhancing the backbone network's ability to model global features and reducing the number of parameters of the backbone network. The processing process of the input features by the MBPTB module is as follows:
[0046] Step 2.1.1, use 1×1 convolution to fuse the feature map of the input MBPTB module to obtain the fused feature map, and then divide the fused feature map into two parts. One part of the feature map is used as the input feature map of the left branch identity mapping module and is directly transmitted to the Concat module to retain the original feature information. The other part of the feature map is used as the input feature map of the right branch and passes through 6 PTB modules for multiple averaging operations. Each time it passes through a PTB module, it will be evenly divided. The two parts of the feature map generated by the averaging operation are respectively input into the MHSA-CGLU module and the Bottleneck module, and then the feature maps output by the MHSA-CGLU module and the Bottleneck module are fused using 1×1 convolution as the output feature map of the PTB module, where:
[0047] The processing process of the input feature map of the Bottleneck module is as follows: the feature map of the input Bottleneck module is processed by two CBS modules in sequence, and then the feature map output by the last CBS module is added to the feature map of the input Bottleneck module to obtain the output feature map of the Bottleneck module;
[0048] The processing process of the MHSA-CGLU module on the input feature map is as follows: the feature map input to the MHSA-CGLU module passes through the cascaded LayerNorm2d module, the MHSA module and the DropPatch module in sequence to obtain a feature map K1, the feature map K1 is added to the feature map input to the MHSA-CGLU module to obtain a feature map K2, the feature map K2 passes through the cascaded LayerNorm2d module, the CGLU module and the DropPatch module in sequence to obtain a feature map K3, the feature map K2 and the feature map K3 are added to obtain an output feature map of the MHSA-CGLU module;
[0049] Preferably, the MHSA module is a multi-head attention module with 8 heads;
[0050] The processing process of the CGLU module on the input feature map is as follows: the feature map of the input CGLU module is divided into two parts in the channel dimension, one part passes through the left branch composed of a cascaded linear layer, a 3×3 deep convolution module and an Activation module in sequence, and the other part passes through the right branch composed of a linear layer, and the feature maps output by the left branch and the right branch are multiplied element by element to obtain the feature map L1. After the feature map L1 is processed by a linear layer, it is added to the feature map of the input CGLU module to obtain the output feature map of the CGLU module;
[0051] Preferably, the Activation module is a GELU activation function;
[0052] Combining the processing of the input feature map by the MHSA-CGLU module, the Bottleneck module, and the CGLU module, the processing of the input feature map by the PTB module can be expressed as follows:
[0053] F out_cn ,F out_tr =γ(F input )
[0054] F′ out_cn =Conv(Conv(F out_cn ))+F out_cn
[0055]
[0056] MHSA=Concat(head1,…,head i )N o
[0057]
[0059] F output=Conv(Concat(F′ out_cn F″ out_tr ))
[0062] In the formula, F input ∈C in ×H×W represents the feature map of the input MBPTB, γ represents the operation of dividing the feature map by channel; F′ out_tr Represents K2 feature map; F″ out_tr Represents the output feature map of the MHSA-CGLU module; Represents the feature map of the input to the Bottleneck module; Represents the feature map of the input TransformerBlock module; represents the DropPath operation; MHSA represents the multi-head self-attention module; head i represents the i-th head; Concat represents the concatenation operation; is a learnable weight matrix; Q i represents the query vector of the i-th head; K i represents the key vector of the i-th head; V i Represents the value vector of the i-th head; d k represents the scaling factor; h represents the number of heads in the self-attention; F output Represents the output feature map of the PTB module;
[0063] Step 2.1.2, concatenate the input feature map of the right branch, the input feature map of the left branch, and the output feature map of each PTB module, and then use 1×1 convolution to perform feature fusion on the concatenated feature maps to enhance the feature expression ability of the MBPTB module, and obtain the output feature map of the MBPTB module;
[0064] Step 2.2: First, use CGblock to replace the Bottleneck in the C2f module with the semantic guidance module CGBlock to obtain the MBCGM module. Then use the MBCGM module to replace the C2f module at the detection head position in the neck network of the original YOLOv8n model to promote the interaction between features at different levels and achieve efficient fusion between global features and detail features. Figure 4 As shown in the figure, the processing process of the MBCGM module on the input feature map is:
[0065] Step 2.2.1, first transform the input feature map through the first 1×1 convolutional layer to generate an intermediate feature map, thereby enhancing the feature expression ability of the model, and then split the intermediate feature map into two parts, one part is directly passed to the final Concat module to retain the original feature information; the other part is directly passed to the CGBlock module to extract deeper features;
[0066] Step 2.2.2, first use the 1×1 convolution module to transform the feature map of the input CGBlock module, and then input it into the 3×3 convolution module and the 3×3 dilated convolution module respectively, so that the CGBlock module can learn the features of the defect itself and the features of the surrounding environment from the input feature map. Then, the feature maps output by the 3×3 convolution module and the 3×3 dilated convolution module are concatenated by Concat, processed by BN and SiLU in turn, and then transmitted to the Fusion component. The Fusion component refines the joint features of the local features and the surrounding context information to obtain the output feature map of the CGBlock module;
[0067] Step 2.2.3, concatenate the output feature map of the CGBlock module with the feature map directly passed to the Concat module to form a fused feature map, which increases the diversity of features and helps the model to better aggregate multi-scale information;
[0068] Step 2.2.4, process the fused feature map through the second 1×1 convolutional layer to compress the number of channels to the required number of output channels, and finally output the feature map of the MBCGM module;
[0069] Step 2.3: First replace the convolution module in ADown with dynamic convolution to obtain the DyDown module, and then use the DyDown module to replace the downsampling modules of the third and fifth layers in the original YOLOv8n model backbone network, thereby solving the problem of loss of detail information during the encoding process. Figure 5 As shown in the figure, the DyDown module processes the input features as follows:
[0070] Step 2.3.1. First, perform an average pooling (AvgPool2d) operation on the feature map input to the DyDown module to average multiple adjacent feature values to capture the overall statistical characteristics of these feature values rather than specific details. This aggregation helps the model focus more on global features.
[0071] Step 2.3.2, first divide the feature map processed by the AvgPool2d operation into two parts, and input them into the left branch and the right branch respectively, where: the left branch contains a dynamic convolution layer (DynamicConv), and the right branch contains a maximum pooling layer (MaxPool2d) and a dynamic convolution layer (DynamicConv). The MaxPool2d layer helps the DyDown module to focus more on the key parts of the input features and suppress the interference of irrelevant information. The dynamic convolution can dynamically generate convolution kernels according to the different defect scales, so as to respond accordingly to defects of different scales. Then, the output feature maps of the left branch and the right branch are spliced to obtain the output feature map of the DyDown module;
[0072] Step 3: Set the parameters first, and then use the training set to train the transmission line insulator defect detection model based on the improved YOLOv8n. During the training process, use the validation set to tune the hyperparameters of the transmission line insulator defect detection model based on the improved YOLOv8n, and obtain the weight file with the best performance on the validation set. Save it as best.pt to obtain the best transmission line insulator defect detection model based on the improved YOLOv8n.
[0073] The process of setting parameters is as follows: set the batch-size to 8, the initial learning rate to 0.001, the weight decay parameter to 0.0005, and the momentum factor to 0.937; use the Adam optimizer, set the number of iterations to 200, and use the cosine annealing algorithm for the learning rate decay strategy;
[0074] During the training process of the transmission line insulator defect detection model based on the improved YOLOv8n, the specific experimental environment configuration parameters are shown in Table 1;
[0075] Table 1 Experimental environment configuration parameters
[0076]
[0077] Step 4: Input the transmission line insulator defect image to be detected into the optimal transmission line insulator defect detection model based on improved YOLOv8n, and output the detection result. The specific process is: input the transmission line insulator defect image to be detected into the transmission line insulator defect detection model based on improved YOLOv8n, load the optimal weight file best.pt stored in step 3, start detection, and output an image marked with the detected object category and its corresponding confidence, which is the final detection result;
[0078] In order to verify the accuracy of the transmission line insulator defect detection model based on the improved YOLOv8n proposed in this embodiment, the test set is input into the original YOLOv8n model and the transmission line insulator defect detection model based on the improved YOLOv8n, and the output results are evaluated using parameter quantity, Precision, Recall and mAP. See Table 2 for details. The calculation formulas of Recall, Recall and mAP are as follows:
[0079]
[0080] Where TP means that the network model correctly detects the annotated object, FP means that the network model incorrectly predicts the background area as the annotated object, and FN means that the network model incorrectly predicts the annotated object as the background area; N means the number of categories, and mAP means the average precision of N categories;
[0081] Table 2 Detection results of different algorithm models on the test set
[0082]
[0083] It can be seen from Table 2 that the transmission line insulator defect detection model based on the improved YOLOv8n has a higher mAP than the original YOLOv8n model. 50 The value increased by 5.3%, and the recall rate of the model increased by 8.9%; in addition, some test results of the transmission line insulator defect detection model based on the improved YOLOv8n on the test set are shown in the figure below: Figure 6 As shown, it can be seen that it can accurately detect small defects of various shapes on the surface of the insulator.
Claims
1. A method for detecting defects in insulators of transmission lines based on improved YOLOv8n, characterized in that: The steps include: Step 1: Obtain a transmission line insulator defect dataset and divide it into a training set, a validation set, and a test set; Step 2: Build a transmission line insulator defect detection model based on improved YOLOv8n. The specific process is as follows: Step 2.1, first replace the MLP module in the MHSA module with the CGLU module to obtain the MHSA-CGLU module, combine the MHSA-CGLU module and the Bottleneck module to form the PTB module, then replace the DenseBlock in the original CSP module with the PTB module to obtain the MBPTB module. The MBPTB module includes a left branch and a right branch. The left branch is an identity mapping module, and the right branch includes 6 PTB modules. Then use the MBPTB module to replace the deepest C2f module in the original YOLOv8n model backbone network; Step 2.2, first use CGblock to replace Bottleneck in the C2f module with CGBlock to obtain the MBCGM module, and then use the MBCGM module to replace the C2f module at the detection head position in the neck network of the original YOLOv8n model; Step 2.3: First replace the convolution module in ADown with dynamic convolution to obtain the DyDown module, and then use the DyDown module to replace the downsampling modules of the third and fifth layers in the original YOLOv8n model backbone network; Step 3: first set the parameters, then use the training set to train the transmission line insulator defect detection model based on the improved YOLOv8n, and use the validation set to tune the hyperparameters of the transmission line insulator defect detection model based on the improved YOLOv8n during the training process to obtain the optimal transmission line insulator defect detection model based on the improved YOLOv8n; Step 4: Input the transmission line insulator defect image to be detected into the optimal transmission line insulator defect detection model based on improved YOLOv8n, and output the detection result.
2. The method for detecting defects in insulators of power transmission lines based on improved YOLOv8n according to claim 1, characterized in that: The data set of step 1 includes 9 types of defects, namely: dirty glass, missing glass, polymer, dirty polymer, two pieces of glass, broken disk, insulator, flashover pollution and snow.
3. The method for detecting defects in insulators of power transmission lines based on improved YOLOv8n according to claim 1, characterized in that: The step 1 divides the transmission line insulator defect data set into a training set, a validation set and a test set according to the sample size of 8:1:
1.
4. The method for detecting defects in insulators of power transmission lines based on improved YOLOv8n according to claim 1, characterized in that: The processing process of the MBPTB module in step 2 on the input features is as follows: Step 2.1.1, use 1×1 convolution to fuse the feature map of the input MBPTB module to obtain the fused feature map, and then divide the fused feature map into two parts. One part of the feature map is used as the input feature map of the left branch and is directly transmitted to the Concat module. The other part of the feature map is used as the input feature map of the right branch. It passes through 6 PTB modules for multiple equal division operations. The two parts of the feature map generated by the equal division operation are respectively input into the MHSA-CGLU module and the Bottleneck module. Then, use 1×1 convolution to fuse the feature maps output by the MHSA-CGLU module and the Bottleneck module as the output feature map of the PTB module; Step 2.1.2: Concatenate the input feature map of the right branch, the input feature map of the left branch, and the output feature map of each PTB module, and then use 1×1 convolution to perform feature fusion on the concatenated feature maps.
5. The method for detecting defects in insulators of power transmission lines based on improved YOLOv8n according to claim 1, characterized in that: The processing process of the input feature map by the Bottleneck module in step 2.1.1 is as follows: the feature map input to the Bottleneck module is processed by two CBS modules in sequence, and then the feature map output by the last CBS module is added to the feature map input to the Bottleneck module to obtain the output feature map of the Bottleneck module.
6. The method for detecting defects in insulators of power transmission lines based on improved YOLOv8n according to claim 1, characterized in that: The processing process of the input feature map by the MHSA-CGLU module in the step 2.1.1 is as follows: the feature map input to the MHSA-CGLU module passes through the cascaded LayerNorm2d module, MHSA module and DropPatch module in sequence to obtain feature map K1, the feature map K1 is added to the feature map of the input MHSA-CGLU module to obtain feature map K2, the feature map K2 passes through the cascaded LayerNorm2d module, CGLU module and DropPatch module in sequence to obtain feature map K3, the feature map K2 and the feature map K3 are added to obtain the output feature map of the MHSA-CGLU module.
7. The method for detecting defects in insulators of power transmission lines based on improved YOLOv8n according to claim 6, characterized in that: The processing process of the CGLU module on the input feature map is as follows: the feature map of the input CGLU module is divided into two parts in the channel dimension, one part passes through the left branch composed of a cascaded linear layer, a 3×3 deep convolution module and an Activation module in sequence, and the other part passes through the right branch composed of a linear layer. The feature maps output by the left branch and the right branch are multiplied element by element to obtain the feature map L1. After the feature map L1 is processed by a linear layer, it is added to the feature map of the input CGLU module to obtain the output feature map of the CGLU module.
8. The method for detecting defects in insulators of power transmission lines based on improved YOLOv8n according to claim 1, characterized in that: The processing process of the MBCGM module in step 2 on the input feature map is as follows: Step 2.2.1, first transform the input feature map through the first 1×1 convolutional layer to generate an intermediate feature map, thereby enhancing the feature expression ability of the model, and then split the intermediate feature map into two parts, one part is directly passed to the final Concat module to retain the original feature information; the other part is directly passed to the CGBlock module to extract deeper features; Step 2.2.2: First, the feature map input to the CGBlock module is transformed using a 1×1 convolution module, and then input into a 3×3 convolution module and a 3×3 dilated convolution module, so that the CGBlock module learns the features of the defect itself and the surrounding environment from the input feature map. Then, the feature maps output by the 3×3 convolution module and the 3×3 dilated convolution module are concatenated by Concat, processed by BN and SiLU in turn, and then transmitted to the Fusion component, which refines the joint features of the local features and the surrounding context information. Step 2.2.3, concatenate the feature map processed by the CGBlock module with the feature map directly passed to the Concat module to form a fused feature map, which increases the diversity of features and helps the model to better aggregate multi-scale information; Step 2.2.4: Process the fused feature map through the second 1×1 convolutional layer to compress the number of channels to the required number of output channels, and finally output the feature map of the MBCGM module.
9. The method for detecting defects in insulators of power transmission lines based on improved YOLOv8n according to claim 1, characterized in that: The processing process of the DyDown module in step 2 on the input features is: Step 2.3.
1. First, perform the AvgPool2d operation on the feature map input to the DyDown module to average multiple adjacent feature values to capture the overall statistical characteristics of these feature values rather than specific details. This aggregation helps the model focus more on global features. Step 2.3.2, first divide the feature map processed by the AvgPool2d operation into two parts, and input them into the left branch and the right branch respectively, where: the left branch contains a dynamic convolution layer, and the right branch contains the MaxPool2d layer and the dynamic convolution layer. The MaxPool2d layer helps the DyDown module to focus more on the key parts of the input features and suppress the interference of irrelevant information. The dynamic convolution can dynamically generate convolution kernels according to the different scales of defects, thereby responding accordingly to defects of different scales. Then, the output feature maps of the left branch and the right branch are spliced to obtain the output feature map of the DyDown module.
10. The method for detecting defects in insulators of power transmission lines based on improved YOLOv8n according to claim 1, characterized in that: The process of setting parameters in step 3 is as follows: batch-size is set to 8, initial learning rate is set to 0.001, weight decay parameter is set to 0.0005, momentum factor is set to 0.937; Adam optimizer is used, number of iterations is set to 200, and cosine annealing algorithm is used as the learning rate decay strategy.