Lightweight insulator defect detection method based on improved YOLOv5 network

By improving the YOLOv5 network, the problems of difficult image acquisition and low accuracy in complex environment recognition in the detection of insulator defects in transmission lines were solved, achieving efficient and accurate insulator defect detection, and reducing the model size, which is convenient for practical applications.

CN118967550AActive Publication Date: 2024-11-15CHINA THREE GORGES UNIV

Patent Information

Application Number
CN202410872115.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-01
Publication Date
2024-11-15
Estimated Expiration
2044-07-01

AI Technical Summary

Technical Problem

Existing technologies for detecting defects in transmission line insulators suffer from several problems, including difficulty in acquiring defect images, limited methods for detecting and identifying various defect types, low accuracy in complex environments, and insufficient detection precision of lightweight models.

Method used

An improved YOLOv5 network was adopted, which improved the small target recognition capability and reduced the model size by augmenting the dataset and improving the network structure, including adding the TriFusion module, CBAM attention module, C3Ghost module and multi-scale fusion module.

Benefits of technology

It improves the efficiency and accuracy of insulator defect detection in complex environments, reduces model size, and facilitates practical deployment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118967550A_ABST
    Figure CN118967550A_ABST
Patent Text Reader

Abstract

The invention discloses a lightweight insulator defect detection method based on improved YOLOv5, and the method comprises the steps: obtaining an insulator picture data set, carrying out the preprocessing of insulator pictures in the insulator picture data set, and obtaining an insulator picture training set and an insulator picture verification set; yOLOv5 is improved, firstly, a fusion branch is added between a backbone network and a neck network, a three-level fusion module is reflected in the neck network, secondly, a CBAM module is added to enhance effective features, then, an enhanced small target module is added, and finally, a C3 module is replaced with a lighter C3Ghost module; appropriate equipment and experiment parameters are selected to train and verify the improved YOLOv5 network model, and an insulator detection network model is obtained; and the improved model is evaluated. According to the invention, the problems of low insulator detection precision and large detection model in a complex environment are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of insulator defect detection, and in particular relates to a lightweight insulator defect detection method based on an improved YOLOv5 network. Background Art

[0002] Insulators in transmission line systems are prone to abnormal problems such as breakage and flashover due to long-term exposure to harsh natural environments. These problems may cause regional power outages and catastrophic accidents. Regular inspection of insulators is essential for the normal operation of power systems. Manual inspection of insulators is time-consuming and intensive, affected by the natural environment, has low flexibility, and is dangerous. With the development of smart grids, the use of smart devices such as drones and inspection robots can effectively replace manual inspections. These devices use cameras to capture images and use visual algorithms to detect defective parts, which makes them efficient and flexible, and has been widely studied and implemented.

[0003] In recent years, various methods have been introduced to detect component defects, such as traditional image processing and deep learning algorithms. Traditional image processing usually includes two steps: identifying target components and detecting defects using mathematical models. This method can accurately detect component defects, but it requires the establishment of corresponding feature extraction algorithms and defect discrimination models for each type of defect, so it is less practical. Since the rise of deep learning, image semantic segmentation technology has been applied by many scholars to various fields. This technology is a pixel-level classification that greatly improves the accuracy of defect detection. Compared with traditional image processing methods and deep learning algorithms, one of the main advantages of deep learning is that it does not require artificially designed feature extraction, which is effective for detection tasks with different target features and complex image backgrounds, and has better robustness and stronger model generalization capabilities.

[0004] Although deep learning has made progress in detecting defective parts, there are still some problems. First, due to the relatively small number of defective insulator parts on transmission lines, there is a lack of defect images and the acquisition of defect images is also difficult. Second, since most studies only focus on one type of insulator defect, there are few detection and identification methods for multiple defect types. Finally, transmission lines are located in complex environments, such as foggy days; compared with the complex background, the size of the defective parts appearing in the image is small, especially the insulator flashover defect, which reduces the accuracy of defect identification. In addition, the current deep learning algorithm has low detection accuracy for lightweight models and is difficult to meet engineering requirements. Although the model with a large number of parameters has a certain detection accuracy, the model is too large and not easy to deploy in practice. Summary of the invention

[0005] In view of the above-mentioned deficiencies in the prior art, the present invention provides a lightweight insulator defect detection method based on an improved YOLOv5 network. By acquiring accurate insulator images and performing data set augmentation, and improving the structure of YOLOv5, a lightweight network model that is more suitable for insulator defect detection is obtained through training and verification, thereby solving the problems of low efficiency and low accuracy of insulator defect detection in complex environments.

[0006] The technical solution adopted by the present invention is:

[0007] The lightweight insulator defect detection method based on the improved YOLOv5 network includes the following steps:

[0008] Step 1: Obtain an insulator image dataset, and preprocess the insulator images in the insulator image dataset to obtain an insulator image training set and an insulator image verification set;

[0009] Step 2: Improve the YOLOv5 network to improve the recognition effect of insulators in complex environments and the recognition ability of small targets such as insulator flashover defects, while reducing the model size to facilitate actual deployment;

[0010] Step 3: Use the obtained insulator image training set and insulator image verification set to train and verify the improved YOLOv5 network model to obtain a network model that can identify insulators and insulator defects.

[0011] Step 4: Model comparison and evaluation, improvement effect evaluation.

[0012] The step 1 comprises the following steps:

[0013] S1.1. Collect the insulator images currently downloaded publicly and taken on site to form the original data set;

[0014] S1.2. Select the insulator images in the original data set one by one, remove the invalid insulator images, and leave the clear and visible valid images, including insulator damage defects, insulator flashover defects and normal insulator images.

[0015] S1.3, randomly selecting some insulator pictures, adding Gaussian blur to the selected insulator pictures, and changing the saturation and brightness of the selected insulator pictures to expand the data set of insulator pictures;

[0016] S1.4. The dataset of the present invention has a total of 3500 images. The LabelImg tool is then used to annotate the images. The labels are as follows: damaged insulators are marked as damaged, flashover insulators are marked as flashover, and normal insulators are marked as insulators. Finally, the dataset is divided into a training set and a validation set at a ratio of 8:2.

[0017] In S1.3, the Gaussian blur calculation formula is as follows:

[0018]

[0019] Where: μ and ν represent the horizontal and vertical coordinates of the coordinates with the fuzzy center as the origin, μ 2 +ν 2 =r 2 represents the standard deviation, where r represents the blur radius and σ represents the standard deviation of the normal distribution.

[0020] In step 2, the YOLOv5 network is improved as follows:

[0021] 2.1: Add a fusion branch between the backbone network and the neck network, further extract features, and fuse them into the neck network to form a TriFusion module with a three-level fusion structure;

[0022] 2.2: Integrate CBAM attention module: embed a layer of CBAM attention module at the end of the backbone network, embed a layer of CBAM attention module after the three-level fusion module TriFusion, and embed a layer of CBAM attention module after the last two-level fusion Cancat layer of the neck network;

[0023] 2.3: Add a multi-scale fusion module for small reinforced insulator targets;

[0024] 2.4: Replace the C3 module in the original YOLOv5 network model with a lighter C3Ghost module.

[0025] In the step 2, the improved YOLOv5 network model includes a Conv module, and the Conv module is used to extract features and downsample to reduce the dimension of the input feature map;

[0026] The function of the C3Ghost module in the improved YOLOv5 network model is to extract features, increase the receptive field, and increase the network depth. It has a smaller number of parameters than the C3 module in the original model. The bottleneck module in the C3 module is the Bottleneck module, and the bottleneck module in the C3Ghost module is the lighter Ghostbottleneck module. The convolution module in the Bottleneck module is the Conv module, and the convolution module in the Ghostbottleneck module is the GhostConv module. The calculation formulas of the Conv module and the GhostConv module are as follows:

[0027] GFLOP (Conv) =nhwCk 2

[0028]

[0029]

[0030] Where: GFLOP (Conv) Indicates the amount of computation of the Conv module; GFLOP (GhostConv) represents the amount of computation of the GhostConv module; n represents the number of feature maps, h represents the height of the feature map, w represents the width of the feature map, C represents the number of channels, and k represents 2 and d 2 It represents linear operation, and s can be regarded as the compression ratio of the computational complexity of the two. Its value is greater than 1. It can be seen that the computational complexity of C3Ghost is smaller than that of the C3 module.

[0031] The GhostConv module first uses a small number of convolution kernels to extract features from the input feature map, and then further performs simpler linear change operations on this part of the feature map, and finally generates the final feature map through Cancat splicing; this method reduces the learning cost of non-critical features: that is, by combining a small number of convolution kernels with simpler linear change operations instead of conventional convolution methods, it effectively reduces the demand for computing resources without affecting the performance of the model.

[0032] In the step 2, the improved YOLOv5 network model includes an SPPF module, and the SPPF module is used to solve the problem of large target differences;

[0033] In the improved YOLOv5 network model, the CBAM attention module includes a channel attention module and a spatial attention module, and its formula is:

[0034]

[0035] Where: F represents the feature map, M c represents channel-based attention, M S represents spatial-based attention, represents element-by-element multiplication, F′ represents the output feature map after channel attention, and F″ represents the output feature map after spatial attention;

[0036] Where M c (F) can be expressed as follows:

[0037]

[0038] Where: σ represents the sigmoid activation function, W0 and W1 represent two weight-sharing neural networks, represents the average pooling operation, Represents the maximum pooling operation; Indicates that an average pooling operation is performed on the input feature map, followed by a convolution operation; Indicates that the maximum pooling operation is performed on the input feature map, followed by a convolution operation; Indicates that an average pooling operation is performed on the input feature map, followed by two convolution operations; Indicates that the input feature map is subjected to a maximum pooling operation, followed by two convolution operations;

[0039] The above formula means that the input is reduced in dimension using the global maximum pooling and global average pooling layers to obtain two two-dimensional feature maps, and then the channel attention coefficient is obtained through two fully connected layers, which is multiplied by the input to obtain the weighted output;

[0040] Where M s (F) can be expressed as follows:

[0041]

[0042] Where: represents splicing, f 7×7 represents a 7×7 convolution kernel,

[0043] The above formula means that the average pooling operation and the maximum pooling operation are performed on the input feature map, and then the feature maps of the two operations are spliced, and then a 7×7 convolution kernel is used for convolution operation, and finally the sigmoid activation function is used to obtain the final output;

[0044] Furthermore, the calculation formula of the above sigmoid activation function is:

[0045]

[0046] Where: e represents a natural constant, whose value is approximately 2.718; x represents the input feature map.

[0047] In the step 2, the improved YOLOv5 network model includes an Upsample module, which is an upsampling module for expanding the dimension of the image. The height and width of the feature map after the Upsample module are expanded to twice the original respectively;

[0048] In the step 2, the TriFusion module in the improved YOLOv5 network model is a three-level fusion structure with three input ends, two of which come from the backbone network and one comes from the previous upsampling layer; the feature maps of the three input ends have the same dimension, the two feature maps from the backbone network have the same number of channels, and the number of feature map channels from the previous upsampling layer is twice that of the other two.

[0049] In the step 2, the improved YOLOv5 network model includes a Cancat module, which is a two-stage fusion module with two input channels; the Cancat in the enhanced small target module has one input layer from the previous upsampling layer and the other from the backbone network, and the feature map dimensions and channel numbers in the two input layers are the same; the other two Cancat input layers, one from the previous downsampling layer and the other from the upsampling part of the neck network, and the feature map dimensions and channel numbers in the two input layers are the same.

[0050] The beneficial effects of the improved method in S2 are as follows:

[0051] The addition of the fusion branch in 2.1 can effectively improve the accuracy of the information fused from the backbone network to the neck network. The three-level fusion structure can fuse the information in the shallow network of the backbone network with the information in the neck network, deepen the location information of the features in the neck network, locate the target more accurately, and effectively improve the detection accuracy;

[0052] In the above 2.2, a CBAM attention module is finally embedded in the backbone network. The CBAM module uses the characteristics of focusing on relevant features and filtering irrelevant features to effectively improve the effective information entering the neck network, filter invalid information, and effectively improve the final detection accuracy; a CBAM attention module is embedded after the three-level fusion module TriFusion. This is because the three-level feature map fusion increases the noise information. In addition, in S1.3, the present invention explains that Gaussian blur is added to some pictures, which increases the noise signal and further aggravates the superposition of the three-level fusion noise information. Therefore, the present invention embeds a CBAM attention module after the three-level fusion module TriFusion to effectively filter the noise signal; in S23, a CBAM attention module is embedded after the last secondary fusion Cancat layer of the neck network. Since the Cancat module here fuses the information of the shallower convolution layer, there are more noise signals, so a CBAM attention module is embedded to filter the noise signal;

[0053] The multi-scale fusion module for enhancing the small insulator target mentioned in 2.3 aims to increase the multi-level fusion structure of 160×160 dimensions to enhance the recognition ability of small defects such as insulator flashover defects. Its input comes from the shallow network part of the backbone network. The feature map here has strong position information and can better locate the insulator position; the other part comes from the part of the upper layer that is upsampled to generate 160×160 dimensions. Since this part is in the deeper part of the network, it has strong semantic information and can enhance the recognition of flashover defects.

[0054] The C3 module in the original model in 2.4 is replaced with a lighter C3Ghost module to reduce the model size. Through the improvements in 2.1 to 2.3, the model size is larger than the original model. By replacing C3 with C3Ghost, the model size can be effectively reduced, and the detection accuracy does not change much, which is conducive to future actual deployment.

[0055] The step 3 comprises the following steps:

[0056] S3.1. Select appropriate equipment for model training and select appropriate experimental parameters before training. The model training equipment selected by the present invention is: the hardware environment uses Window11 64-bit, the CPU is AMD Ryzen 7 7745HX, the running memory is 16G, and the GPU is NVIDIA GeForce RTX 4060 8G; the software environment uses Python programming language, the deep learning framework is Pytorch, and the training platform is PyCharm;

[0057] Experimental parameters: batch size is 8, initial learning rate is set to 0.01, momentum is set to 0.937, optimizer is SGD, and the number of training rounds is set to 200;

[0058] S3.2, Model training: With the increase of the number of training rounds, the total loss gradually decreases. When it reaches 200 rounds, the total loss fluctuates steadily, indicating that the model has achieved the best detection effect on insulator defects.

[0059] S3.3, Evaluation indicators:

[0060] The evaluation indicators of the present invention are precision (P), recall (R), mean average precision of all categories (mAP0.5), parameter quantity (Params) and operation quantity GFLOPs, wherein precision, recall and mean average precision of all categories evaluate the detection effect of the model, and parameter quantity and operation quantity evaluate the model size, and their formulas are as follows:

[0061]

[0062] Params=IK 2 C+C;

[0063] Where: T P is the defect sample that can be detected correctly, F P is the defect sample that is detected incorrectly, F N are defect samples that have not been detected, AP is the integral of the PR curve for a certain type of defect, and mAP is the average AP of all types of defects; I is the input size, K is the convolution kernel size, and C is the output size.

[0064] In step 4, after completing the above steps, the model is evaluated. The specific steps are as follows:

[0065] S41, comparison between the improved YOLOv5 network model and the original model YOLOv5;

[0066] S42, ablation experiment comparison;

[0067] Specific analysis results of S41 and S42 are given in subsequent embodiments.

[0068] The invention provides a lightweight insulator defect detection method based on an improved YOLOv5 network, which has the following advantages:

[0069] The feature fusion has been strengthened, the interference of noise signals has been reduced, and the detection of insulators in complex environments has been improved. The added small target detection module has effectively improved the detection accuracy of flashover defects. In addition, the size of the model has also been reduced to a certain extent, which is conducive to future actual deployment. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] Figure 1 The present invention is a flowchart of a method for detecting defects in lightweight insulators based on improved YOLOv5 in an embodiment of the present invention.

[0071] FIG2( a ) is a schematic diagram of the structure of the original model YOLOv5 in an embodiment of the present invention;

[0072] FIG2( b ) is a schematic diagram of the structure of an improved YOLOv5 network model in an embodiment of the present invention.

[0073] Figure 3 Schematic diagram of the Conv module structure in an embodiment of the present invention.

[0074] FIG4( a) is a schematic diagram of a C3Ghost module structure in an embodiment of the present invention;

[0075] FIG. 4( b ) is a schematic diagram of the C3 module structure in an embodiment of the present invention.

[0076] Figure 5 Schematic diagram of the Ghostbottleneck module and the Bottleneck module structure in an embodiment of the present invention.

[0077] Figure 6 Schematic diagram of the GhostConv module structure in an embodiment of the present invention.

[0078] Figure 7 Schematic diagram of the SPPF module structure in an embodiment of the present invention.

[0079] Figure 8 Schematic diagram of the CBAM module structure in an embodiment of the present invention.

[0080] Fig. 9 Schematic diagram of the TriFusion structure in an embodiment of the present invention.

[0081] Fig.10 It is the training result of the original model in the embodiment of the present invention.

[0082] Fig.11 The training results of the improved YOLOv5 network model in the embodiment of the present invention are shown. DETAILED DESCRIPTION

[0083] Example:

[0084] like Figure 1 As shown, a process of a lightweight insulator defect detection method based on improved YOLOv5 provided by the present invention includes the following steps:

[0085] S1. Obtain an insulator image dataset, and preprocess the insulator images in the insulator image dataset to obtain an insulator image training set and an insulator image verification set;

[0086] S2. Improve the YOLOv5 network to improve the recognition effect of insulators in complex environments and the recognition ability of small targets such as insulator flashover defects, while reducing the model size to facilitate actual deployment;

[0087] S3, using the obtained insulator image training set and insulator image verification set to train and verify the improved YOLOv5 network model, to obtain a network model capable of identifying insulators and insulator defects;

[0088] S4. Model comparison and evaluation, improvement effect evaluation.

[0089] The step S1 comprises the following steps:

[0090] S11, collect the insulator images currently downloaded publicly and taken on site to form the original data set;

[0091] S12, selecting the insulator images in the original data set one by one, removing invalid insulator images, and leaving clear and visible valid images, including insulator damage defects, insulator flashover defects, and normal insulator images;

[0092] S13, randomly selecting some pictures, adding Gaussian blur to the selected insulator pictures, and changing the saturation and brightness of the selected insulator pictures to expand the data set of insulator pictures;

[0093] The beneficial effects of the above two-step scheme of S12 and S13 are as follows: in the present invention, the saturation and brightness of the image are changed and a noise signal is added while ensuring that the insulator in the image can be identified, in order to simulate the low visibility situation of haze days in real scenes. In this case, the model trained has strong robustness;

[0094] Further, the calculation expression of Gaussian blur in S13 is as follows:

[0095]

[0096] Where: μ, ν represent the horizontal and vertical coordinates of the coordinates with the fuzzy center as the origin, μ 2 +ν 2 =r 2 represents the standard deviation, where r represents the blur radius and σ represents the standard deviation of the normal distribution;

[0097] S14. The dataset of the present invention has 3376 images in total. The LabelImg tool is then used to label the images. The labels are: damaged insulators are marked as damaged, flashover insulators are marked as flashover, and normal insulators are marked as insulator. Finally, the dataset is divided into a training set and a validation set at a ratio of 8:2.

[0098] Furthermore, the S2 improves the YOLOv5 network to make it more suitable for insulator detection in complex environments, more conducive to detecting small targets, and with a smaller number of model parameters;

[0099] As shown in Figure 2(a) and Figure 2(b), compared with the original model in Figure 2(a), the improvement of the improved model in Figure 2(b) is as follows:

[0100] S21, adding a fusion branch between the backbone network and the neck network, further extracting features and fusing them into the neck network to form a three-level fusion structure TriFusion;

[0101] S22, embed a CBAM attention module at the end of the backbone network, embed a CBAM attention module after the three-level fusion module TriFusion in S21, and embed a CBAM attention module after the last two-level fusion Cancat layer of the neck network;

[0102] S23, add a multi-scale fusion module for small reinforced insulator targets;

[0103] S24. Replace the C3 module in the original model with a lighter C3Ghost module.

[0104] Furthermore, if Figure 3The figure shows the Conv module in the improved YOLOv5 network model in S2. In this module, the input feature map first undergoes a convolution operation, then a BN neural network, and finally a SiLU activation module. The function of the Conv module is to extract features and downsample to reduce the dimension of the input feature map.

[0105] Furthermore, the formula of the SiLU activation function is as follows:

[0106]

[0107] Furthermore, in Figure 2(b), Conv(6,2) represents a Conv convolution block with a convolution kernel of 6 and a stride of 2. Its main purpose is to reduce the dimension of the input feature map while extracting features. The height and width of the feature map are both halved. In Figure 2(b), Conv(3,2) represents a Conv convolution block with a convolution kernel of 3 and a stride of 2. Its main purpose is to reduce the dimension of the feature map while extracting features. The height and width of the feature map are both halved. In Figure 2(b), Conv(1,1) represents a Conv convolution block with a convolution kernel of 1 and a stride of 1. Its main purpose is to extract features without changing the input feature map.

[0108] Furthermore, as shown in FIG4(a), the C3Ghost module in the improved YOLOv5 network model described in S2 is used to extract features, increase the receptive field, and increase the network depth. Compared with the C3 module in the original model, it has a smaller number of parameters. The schematic diagram of the C3 module structure is shown in FIG4(b). The bottleneck module in the C3 module is the Bottleneck module, and the bottleneck module in the C3Ghost module is a lighter Ghostbottleneck module. Figure 5 It can be seen that the convolution module in the Bottleneck module is the Conv module, and the convolution module in the Ghostbottleneck module is the GhostConv module. The calculation formulas of the Conv module and the GhostConv module are as follows:

[0109] GFLOP (Conv) =nhwCk 2 ;

[0110]

[0111] Where: n represents the number of feature maps, h represents the height of the feature map, w represents the width of the feature map, C represents the number of channels, k 2 and d 2 represents linear operation, and s can be regarded as the compression ratio of the computational complexity of the two. Its value is greater than 1. It can be seen that the computational complexity of the GhostConv module is smaller than that of the Conv module, so the computational complexity of the C3Ghost module is smaller than that of the C3 module.

[0112] Furthermore, if Figure 6 The GhostConv module structure first uses a small number of convolution kernels to extract features from the input feature map, then further performs cheaper linear change operations on this part of the feature map, and finally generates the final feature map through Cancat splicing; this method reduces the learning cost of non-critical features: that is, by combining a small number of convolution kernels with cheaper linear change operations instead of conventional convolution methods, it effectively reduces the demand for computing resources without affecting the performance of the model.

[0113] Furthermore, if Figure 7 The figure shows the structure of the SPPF module in the improved YOLOv5 network model in S2. The function of this module is to solve the problem of large target differences. It undergoes one convolution operation and three maximum pooling operations, and concatenates the feature maps after each operation, effectively reducing the situation where the feature maps have large differences.

[0114] Furthermore, if Figure 8 The CBAM module in the improved YOLOv5 network model in S2 is shown, which includes a channel attention module and a spatial attention module, and its formula is:

[0115]

[0116] Where: F represents the feature map, M c represents channel-based attention, M s represents spatial-based attention, represents element-by-element multiplication, F′ represents the output feature map after channel attention, and F″ represents the output feature map after spatial attention;

[0117] M c (F) can be expressed as follows:

[0118]

[0119] Where: σ represents the sigmoid activation function, W0 and W1 represent two weight-sharing neural networks, represents the average pooling operation, Represents the maximum pooling operation; this formula means using the global maximum pooling and global average pooling layers to reduce the dimension of the input to obtain two two-dimensional feature maps, and then obtain the channel attention coefficient through two fully connected layers, which is multiplied by the input to obtain the weighted output.

[0120] M s (F′) can be expressed as follows:

[0121]

[0122] Where: represents splicing, f 7×7 Represents a 7×7 convolution kernel. This formula means performing average pooling and maximum pooling operations on the input feature map, concatenating the feature maps of the two operations, and then performing a convolution operation with a 7×7 convolution kernel. Finally, the final output is obtained through the sigmoid activation function.

[0123] Furthermore, the Upsample module in the improved YOLOv5 network model in S2 is an upsampling module, which is used to expand the dimension of the image. The height and width of the feature map after the Upsample module are expanded to twice the original.

[0124] Furthermore, the calculation formula of the above sigmoid activation function is:

[0125]

[0126] Furthermore, if Fig. 9 As shown, the TriFusion module in the improved YOLOv5 network model in S2 is a three-level fusion module with three input ends, two of which come from the backbone network and one from the upper upsampling layer. The feature maps of the three input ends have the same dimension, the two feature maps from the backbone network have the same number of channels, and the feature map from the upper upsampling layer is twice that of the other two.

[0127] Furthermore, the Cancat module in the improved YOLOv5 network model in S2 is a two-level fusion module with two input channels; the input layer of Cancat in the enhanced small target module comes from the previous upsampling layer and the other from the backbone network, and the feature map dimensions and channel numbers in the two input layers are the same; the other two Cancat input layers, one comes from the previous downsampling layer and the other comes from the upsampling part of the neck network, and the feature map dimensions and channel numbers in the two input layers are the same.

[0128] The reasons for the improvement of the improved method in S2 and its advantages over the original model are as follows:

[0129] Adding a fusion branch in S21 can effectively improve the accuracy of the information fused from the backbone network to the neck network. The three-level fusion structure can fuse the information in the shallow network of the backbone network with the information in the deep network of the neck network, thereby enhancing the location information of the features in the deep network and effectively improving the detection accuracy.

[0130] In the S22, a layer of CBAM attention module is finally embedded in the backbone network. The CBAM module uses the characteristics of focusing on relevant features and filtering irrelevant features to effectively improve the effective information entering the neck network, filter invalid information, and effectively improve the final detection accuracy; a layer of CBAM attention module is embedded after the three-level fusion module TriFusion. This is because the three-level feature map fusion increases the noise information. In addition, in S13, the present invention explains that Gaussian blur is added to some pictures, which increases the noise signal and further aggravates the superposition of the three-level fusion noise information. Therefore, the present invention embeds a layer of CBAM attention module after the three-level fusion module TriFusion to effectively filter the noise signal; in the S23, a layer of CBAM attention module is embedded after the last secondary fusion Cancat layer of the neck network. Since the Cancat module here fuses the information of the shallower convolution layer, there are more noise signals, so a layer of CBAM attention module is embedded to filter the noise signal;

[0131] The multi-scale fusion module for enhancing the small insulator target mentioned in S23 aims to increase the multi-level fusion structure of 160×160 dimensions to enhance the recognition capability of small defects such as insulator flashover defects. Its inputs come from the shallow network part of the backbone network. The feature map here has strong position information, which can better locate the insulator position; the other part comes from the part of the upper layer that is upsampled to generate 160×160 dimensions. Since this part is in the deeper part of the network, it has strong semantic information and can enhance the recognition of flashover defects.

[0132] The C3 module in the original model in S24 is replaced with a lighter C3Ghost module to reduce the model size. Through the improvements of S21-S23, the model size is larger than the original model. By replacing C3 with C3Ghost, the model size can be effectively reduced, and the detection accuracy does not change much, which is conducive to future actual deployment;

[0133] Furthermore, the steps of S3 are as follows:

[0134] S31. Select appropriate equipment for model training, and select appropriate experimental parameters before training; the model training equipment selected by the present invention is: the hardware environment uses Window11 64-bit, the CPU is AMD Ryzen 7 7745HX, the running memory is 16G, and the GPU is NVIDIA GeForce RTX 4060 8G; the software environment uses Python programming language, the deep learning framework is Pytorch, and the training platform is PyCharm.

[0135] The experimental parameters are: batch size is 8, initial learning rate is set to 0.01, momentum is set to 0.937, optimizer is SGD, and the number of training rounds is set to 200.

[0136] S32, model training. With the increase of the number of training rounds, the total loss gradually decreases. When it reaches 200 rounds, the total loss fluctuates steadily, indicating that the model has achieved the best detection effect on insulator defects.

[0137] S33, evaluation indicators:

[0138] The evaluation indicators of the present invention are precision (P), recall (R), mean average precision of all categories (mAP0.5), parameter quantity (Params) and operation quantity GFLOPs, wherein precision, recall and mean average precision of all categories evaluate the detection effect of the model, and parameter quantity and operation quantity evaluate the model size, and their formulas are as follows:

[0139]

[0140] Params=IK 2 C+C

[0141] Where: T P is the defect sample that can be detected correctly, F P is the defect sample that is detected incorrectly, F N are defect samples that have not been detected, AP is the integral of the PR curve for a certain type of defect, and mAP is the average AP of all types of defects; I is the input size, K is the convolution kernel size, and C is the output size.

[0142] Furthermore, the S4 evaluates the model after completing the S1-S3 steps, and the specific steps are as follows:

[0143] S41, improved YOLOv5 model compared with the original model YOLOv5;

[0144] As shown in Table 1 below, by comparing the original model and the improved model of YOLOv5 in this embodiment, it can be seen that the improved model is significantly improved compared with the original model; for the accuracy of insulator defect detection, the improved model is improved by 3.9% compared with the original model; for the recall rate of insulator defect detection, the improved model is improved by 3.4% compared with the original model; for the average precision of all categories of insulator detection, the improved model is improved by 3.2% compared with the original model; the improved model is significantly improved in the effect of insulator defect detection compared with the original model;

[0145] The improved model reduces the model parameters by 1.7×10 compared with the original model. 6, reducing the number of parameters by 24.2%; in terms of the amount of computation, the improved model reduces 1.6 and 10.1% of the original model. Compared with the original model, the improved model has a significantly reduced model size, which is conducive to the deployment of the later embedded platform;

[0146] Table 1 Comparison table of YOLOv5 original model and improved YOLOv5 network model

[0147]

[0148] Furthermore, if Fig.10 This is the PR curve obtained by training the original model, such as Fig.11 To improve the PR curve obtained by model training, from the comparison of the two curves, there is no obvious change in the accuracy of normal insulator detection of the improved model compared with the original model, but the detection accuracy has reached more than 95%, which is of little significance for improving the detection accuracy of normal insulators; the improved model has improved the accuracy of damaged insulator detection from 70.6% to 76% compared with the original model, an increase of 5.4%; the improved model has improved the accuracy of flashover insulator detection from 78.4% to 82.5% compared with the original model, an increase of 4.1%; the improved model has improved the average accuracy of the entire category from 82.2% to 85.4% compared with the original model, an increase of 3.2%; the improved model has significantly improved the detection effect of insulator defects in complex environments, and has significantly improved the small target defects such as flashover.

[0149] S42, ablation experiment comparison;

[0150] As shown in Table 2 below, in order to verify the improved effect of the YOLOv5 algorithm in the present invention, this embodiment uses ablation experiments to verify various improved aspects. First, the first group is the unimproved original model YOLOv5, the second group adds a fusion branch between the backbone network and the neck network to the original model, and forms a three-level fusion structure; the third group embeds the CBAM attention module on the basis of the second group, respectively at the end of the backbone network, after the three-level fusion module and after the last two-level fusion module; the fourth group introduces an enhanced small target module on the basis of the third group; the fifth group lightweights the model on the basis of the fourth group, and replaces the C3 module in the fourth group model with a lighter C3Ghost module; the experimental data are shown in Table 2 below;

[0151] Table 2 Experimental data table

[0152]

[0153] As can be seen from Table 2, after adding the fusion branch between the backbone network and the neck network, the detection accuracy increased by only 0.9% compared with the original model, but after adding the CBAM attention module, the detection accuracy increased by 2.9% compared with the original model, which shows the importance of the CBAM attention module for noise signal filtering; after adding the enhanced small target module in the fourth group, the detection accuracy was further improved by 0.9%, and the detection accuracy increased by 3.8% compared with the original model, but the number of parameters increased by 4.6×10 5 The YOLOv5 model itself is relatively large and not conducive to deployment, so the fifth group made the model lightweight. The detection accuracy of the lightweight model only decreased by 0.6%, but the number of model parameters decreased by 2.16×10 6 , a decrease of 28.9%, which is conducive to later deployment while ensuring that the accuracy does not change much; from the above experimental results, it can be concluded that each step of improvement has achieved the expected effect, and the final improved model has also achieved the improvement of detection accuracy and the lightweight of the model.

[0154] The principle of a lightweight insulator defect detection method based on improved YOLOv5 provided by the present invention is: improvements are made on the basic framework of YOLOv5, and the improvements mainly include: 1. adding a fusion branch between the backbone network and the neck network, and forming a three-level fusion structure in the neck network; 2. embedding a layer of CBAM module at the connection point between the backbone network and the neck network, and adding a CBAM attention module after the three-level fusion structure and the last two-level fusion structure; 3. adding a module for enhancing small target detection; 4. All C3 modules in the improved model are replaced with C3Ghost modules.

[0155] The above improved method provided by the present invention strengthens feature fusion, reduces the interference of noise signals, improves the detection of insulators in complex environments, and the added small target detection module effectively improves the detection accuracy of flashover defects. In addition, the size of the model is also reduced to a certain extent, which is conducive to future practical deployment.

Claims

1. A lightweight insulator defect detection method based on an improved YOLOv5 network is characterized by The following steps are involved: Step 1: Obtain an insulator image dataset, and preprocess the insulator images in the insulator image dataset to obtain an insulator image training set and an insulator image verification set; Step 2: Improve the YOLOv5 network to improve the recognition effect of insulators in complex environments and the recognition ability of small targets such as insulator flashover defects; Step 3: Use the obtained insulator image training set and insulator image verification set to train and verify the improved YOLOv5 network model to obtain a network model that can identify insulators and insulator defects.

2. The lightweight insulator defect detection method based on the improved YOLOv5 network according to claim 1 is characterized in that: It also includes step 4: model comparison and evaluation, and improvement effect evaluation.

3. The lightweight insulator defect detection method based on the improved YOLOv5 network according to claim 1 is characterized in that: The step 1 comprises the following steps: S1.1, collect insulator images to form the original data set; S1.

2. Select the insulator images in the original data set one by one, remove the invalid insulator images, and leave the clear and visible valid images, including insulator damage defects, insulator flashover defects and normal insulator images. S1.3, randomly selecting some insulator pictures, adding Gaussian blur to the selected insulator pictures, and changing the saturation and brightness of the selected insulator pictures to expand the data set of insulator pictures; S1.

4. Use the LabelImg tool to label the images. The labels are as follows: damaged insulators are marked as damaged, flashover insulators are marked as flashover, and normal insulators are marked as insulators. Finally, the dataset is divided into a training set and a validation set in a ratio of 8:

2.

4. The lightweight insulator defect detection method based on the improved YOLOv5 network according to claim 3 is characterized in that: In S1.3, the Gaussian blur calculation formula is as follows: Where: μ and ν represent the horizontal and vertical coordinates of the coordinates with the fuzzy center as the origin, μ 2 +ν 2 =r 2 represents the standard deviation, where r represents the blur radius and σ represents the standard deviation of the normal distribution.

5. The lightweight insulator defect detection method based on the improved YOLOv5 network according to claim 1 is characterized in that: In step 2, the YOLOv5 network is improved as follows: 2.1: Add a fusion branch between the backbone network and the neck network, further extract features, and fuse them into the neck network to form a TriFusion module with a three-level fusion structure; 2.2: Integrate CBAM attention module: embed a layer of CBAM attention module at the end of the backbone network, embed a layer of CBAM attention module after the three-level fusion module TriFusion, and embed a layer of CBAM attention module after the last two-level fusion Cancat layer of the neck network; 2.3: Add a multi-scale fusion module for small reinforced insulator targets; 2.4: Replace the C3 module in the original YOLOv5 network model with a lighter C3Ghost module.

6. The lightweight insulator defect detection method based on the improved YOLOv5 network according to claim 5 is characterized in that: In the step 2, the improved YOLOv5 network model includes a Conv module, and the Conv module is used to extract features and downsample to reduce the dimension of the input feature map; The function of the C3Ghost module in the improved YOLOv5 network model is to extract features, increase the receptive field, and increase the network depth; the bottleneck module in the C3Ghost module is a lighter Ghostbottleneck module, and the convolution module in the Ghostbottleneck module is the GhostConv module. The calculation formulas of the Conv module and the GhostConv module are as follows: GFLOP (Conv) =nhwCk 2 Where: GFLOP (Conv) Indicates the amount of computation of the Conv module; GFLOP (GhostConv) represents the amount of computation of the GhostConv module; n represents the number of feature maps, h represents the height of the feature map, w represents the width of the feature map, C represents the number of channels, and k represents 2 and d 2 Represents linear operation, s can be regarded as the compression ratio of the two operations, and its value is greater than 1; The GhostConv module first uses a small number of convolution kernels to extract features from the input feature map, then further performs simpler linear transformation operations on this part of the feature map, and finally generates the final feature map through Cancat splicing.

7. The lightweight insulator defect detection method based on the improved YOLOv5 network according to claim 6 is characterized in that: The improved YOLOv5 network model includes the SPPF module, which is used to solve the problem of large target differences; In the improved YOLOv5 network model, the CBAM attention module includes a channel attention module and a spatial attention module, and its formula is: Where: F represents the feature map, M c represents channel-based attention, M S represents spatial-based attention, represents element-by-element multiplication, F′ represents the output feature map after channel attention, and F″ represents the output feature map after spatial attention; Where M c (F) can be expressed as follows: Where: σ represents the sigmoid activation function, W0 and W1 represent two weight-sharing neural networks, represents the average pooling operation, Represents the maximum pooling operation; Indicates that an average pooling operation is performed on the input feature map, followed by a convolution operation; Indicates that the input feature map is subjected to a maximum pooling operation, followed by a convolution operation; Indicates that an average pooling operation is performed on the input feature map, followed by two convolution operations; Indicates that the input feature map is subjected to a maximum pooling operation, followed by two convolution operations; The above formula means that the input is reduced in dimension using the global maximum pooling and global average pooling layers to obtain two two-dimensional feature maps, and then the channel attention coefficient is obtained through two fully connected layers, which is multiplied by the input to obtain the weighted output; Where M s (F) is expressed as follows: Where: represents splicing, f 7×7 represents a 7×7 convolution kernel, The above formula means that the average pooling operation and the maximum pooling operation are performed on the input feature map, and then the feature maps of the two operations are spliced, and then a 7×7 convolution kernel is used for convolution operation, and finally the sigmoid activation function is used to obtain the final output; Furthermore, the calculation formula of the above sigmoid activation function is: Where: e represents a natural constant; x represents the input feature map.

8. The lightweight insulator defect detection method based on the improved YOLOv5 network according to claim 7 is characterized in that: The improved YOLOv5 network model includes an Upsample module. The Upsample module is an upsampling module that expands the dimension of the image. The height and width of the feature map after the Upsample module are expanded to twice the original. The TriFusion module in the improved YOLOv5 network model is a three-level fusion structure with three input ends, two of which come from the backbone network and one from the previous upsampling layer. The feature maps of the three input ends have the same dimensions, the two feature maps from the backbone network have the same number of channels, and the feature map from the previous upsampling layer has twice the number of channels of the other two. The improved YOLOv5 network model includes the Cancat module, which is a two-stage fusion module with two input channels. The input layer of the Cancat in the enhanced small target module comes from the previous upsampling layer and the backbone network, and the feature map dimensions and channel numbers in the two input layers are the same. The other two Cancat input layers, one comes from the previous downsampling layer and the other comes from the upsampling part of the neck network, and the feature map dimensions and channel numbers in the two input layers are the same.

9. The lightweight insulator defect detection method based on the improved YOLOv5 network according to claim 1 is characterized in that: The step 3 comprises the following steps: S3.

1. Select appropriate equipment for model training and select appropriate experimental parameters before training; S3.2, Model training: With the increase of the number of training rounds, the total loss gradually decreases. When it reaches 200 rounds, the total loss fluctuates steadily, indicating that the model has achieved the best detection effect on insulator defects. S3.3, Evaluation indicators: The evaluation indicators selected are precision (P), recall (R), mAP0.5, parameter count (Params) and GFLOPs. Precision, recall and mAP0.5 evaluate the detection effect of the model, while parameter count and GFLOPs evaluate the model size. Their formulas are as follows: Params=I 2 C+C; Where: T P is the defect sample that can be correctly detected, F P is the defect sample that is detected incorrectly, F N are defect samples that have not been detected, AP is the integral of the PR curve for a certain type of defect, and mAP is the average AP of all types of defects; I is the input size, K is the convolution kernel size, and C is the output size.

10. The lightweight insulator defect detection method based on the improved YOLOv5 network according to claim 2 is characterized in that: In step 4, after completing the above steps, the model is evaluated. The specific steps are as follows: S41, comparison between the improved YOLOv5 network model and the original model YOLOv5; S42. Comparison of ablation experiments.

Citation Information

Patent Citations

  • Insulator damage detection method based on improved yolov5 algorithm

    CN113920107A

  • Steel surface defect detection method based on improved YOLOv5s

    CN115829991A

  • Insulator defect detection method and device, medium and program product

    CN115984226A

  • Power transmission line intelligent defect detection method based on improved YOLOv5 network

    CN116843649A

  • Unmanned aerial vehicle small target detection method based on dynamic adaptive channel attention

    CN117237830A

Cited By

  • Insulator defect detection method based on lightweight CGC-YOLO

    CN119444752A

  • Early warning method for preventing bird droppings flashover of insulation sleeve from being damaged of power transmission conductor

    CN120298803A

  • Insulator defect detection method based on improved YOLOv11n

    CN120563418A

  • An insulator defect detection method based on improved YOLOv11n

    CN120563418B

  • Defect detection method and system for single-terminal wire

    CN121366155A