A method for detecting defects in insulators

By improving the YOLOv7 network model and introducing the ELAN_Sim_ATT, ELAN_Conv_ATT, SPPCSPC_ATT and MP-2_ATT modules, the problem of low insulator defect detection accuracy is solved, higher detection accuracy and efficiency are achieved, and it is suitable for insulator monitoring in complex environments.

CN118154565BActive Publication Date: 2024-10-18SHENYANG UNIVERSITY OF TECHNOLOGY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410341509.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-25
Publication Date
2024-10-18
Estimated Expiration
2044-03-25

AI Technical Summary

Technical Problem

Existing insulator defect detection methods have low accuracy and are difficult to effectively identify small targets and insulator defects with large size differences and unbalanced categories in complex environments.

Method used

Improve the YOLOv7 network model, replace the ELAN module in the backbone network with ELAN_Sim_ATT and ELAN_Conv_ATT, the SPPCSPC module in the header with SPPCSPC_ATT, and the MP-2 module with MP-2_ATT, and introduce the Concat_ATT module to enhance feature extraction and attention mechanisms to improve detection accuracy.

Benefits of technology

The accuracy of insulator defect detection is improved. The algorithm mAP@0.5 is increased by 5.1% to 99.6%, which significantly improves the detection accuracy and efficiency and is suitable for insulator monitoring in complex power transmission environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118154565B_ABST
    Figure CN118154565B_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image detection, and provides an insulator defect detection method. The method comprises the following steps: improving an original YOLOv7 network model, replacing the first two ELAN modules in a backbone network of the original YOLOv7 network model with ELAN_Sim_ATT modules, replacing the last two ELAN modules in the backbone network of the original YOLOv7 network model with ELAN_Conv_ATT modules, replacing the SPPCSPC module in a head of the original YOLOv7 network model with a SPPCSPC_ATT module, replacing the two Concat modules in the head of the original YOLOv7 network model with a Concat_ATT module, and replacing the two MP‑2 modules in the head of the original YOLOv7 network model with an MP‑2_ATT module to obtain an improved YOLOv7 network model; and using the improved YOLOv7 network model to identify whether an insulator string is missing, the improved YOLOv7 network model has high accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image detection, and in particular to an insulator defect detection method. Background Art

[0002] In the power system, with the continuous development of society and the continuous improvement of the power system, transmission lines, as an important part of the power system, undertake the key task of electric energy transmission. However, in the operation of transmission lines, insulators, as one of the key components, have a direct impact on the reliability and safety of transmission lines due to their quality and status. Due to the characteristics of the equipment itself and the complexity of the environment in which it is located, its detection brings challenges such as target overlap, large size differences, small targets, and unbalanced categories. Therefore, it is particularly important to identify and monitor defects of insulators in a timely and accurate manner.

[0003] Traditional insulator defect recognition methods usually rely on manual inspection and empirical judgment, which have problems such as low efficiency and low accuracy. In order to overcome these problems, image recognition technology based on deep learning has gradually become a research hotspot in recent years.

[0004] However, the accuracy of the insulator defect detection method in the related technology still needs to be improved. How to provide a new insulator defect detection method with higher accuracy has become a technical problem that urgently needs to be solved. Summary of the invention

[0005] The object of the present invention is to provide an insulator defect detection method to solve the problem of low accuracy of the insulator defect detection method in the prior art.

[0006] In order to achieve the above-mentioned purpose, the present invention provides an insulator defect detection method, comprising the following steps: improving the original YOLOv7 network model, replacing the first two ELAN modules in the backbone network of the original YOLOv7 network model with ELAN_Sim_ATT modules, replacing the last two ELAN modules in the backbone network of the original YOLOv7 network model with ELAN_Conv_ATT modules, replacing the SPPCSPC module in the head of the original YOLOv7 network model with the SPPCSPC_ATT module, replacing the two Concat modules in the head of the original YOLOv7 network model with the Concat_ATT module, and replacing the two MP-2 modules in the head of the original YOLOv7 network model with the MP-2_ATT module to obtain an improved YOLOv7 network model; and using the improved YOLOv7 network model to identify whether an insulator string is missing.

[0007] Furthermore, the implementation method of the ELAN_Sim_ATT module is as follows: first, the first convolutional layer and the second convolutional layer with two branches perform feature extraction, then the input of the third convolutional layer is the output of the first convolutional layer, the input of the fourth convolutional layer is the output of the third convolutional layer, the input of the fifth convolutional layer is the input of the fourth convolutional layer, and the input of the sixth convolutional layer is the output of the fifth convolutional layer. Finally, Concat is used to concatenate the output of the first convolutional layer, the output of the second convolutional layer, the output of the fourth convolutional layer, and the output of the sixth convolutional layer, and then the concatenated feature map is passed to the attention mechanism Conv_Sim_ATT to extract key features; the attention mechanism Conv_Sim _ATT is implemented as follows: In the init method: use nn.Conv2d to define a convolution layer, receive c1 input channels, output c2 channels, use a convolution kernel of size k, a step size of s, a padding of p, a grouping number of g, and no bias. Define a batch normalization layer nn.BatchNorm2d to normalize the convolution output, use nn.SiLU() as the activation function, and create an instance of SimAM att, which represents the attention mechanism of adaptive modulation; In the forward method, the input x is first processed by the convolution layer, the batch normalization layer, and the activation function to obtain the feature tensor, and then the feature tensor is passed to The adaptive modulation attention mechanism SimAM is given to obtain the feature tensor modulated by attention, that is, the enhanced feature representation; in the fuseforward method, the input x is first processed by the convolution layer and the activation function to obtain the feature tensor, and then the feature tensor is passed to the adaptive modulation attention mechanism SimAM to obtain the feature tensor modulated by attention; the implementation method of SimAM is as follows: in the init method: the activation function is defined as Sigmoid, and a small constant e_lambda is set for numerical stability; in the forward method: receive the input tensor x, whose shape is [batch_size e, channels, height, width]; first calculate the mean of x in the width and height dimensions, and broadcast it to each position to get the square of the difference between x and the mean; then, calculate the normalization coefficient of each position based on the square of the difference: sum up the squares of all differences to get a total variance estimate; divide the total variance estimate by a small constant e_lambda, and add the bias term to get the normalization coefficient; map the normalized coefficient to [0,1] through the Sigmoid activation function, and get the attention weight y; finally, multiply the input tensor x by the obtained attention weight to get the enhanced feature tensor for subsequent task processing.

[0008] Furthermore, the implementation method of the ELAN_Conv_ATT module is as follows: first, the seventh and eighth convolutional layers with two branches are used for feature extraction, followed by the input of the ninth convolutional layer being the output of the seventh convolutional layer, the input of the tenth convolutional layer being the output of the ninth convolutional layer, the input of the eleventh convolutional layer being the input of the tenth convolutional layer, and the input of the twelfth convolutional layer being the output of the eleventh convolutional layer. Finally, Concat is used to concatenate the output of the seventh convolutional layer, the output of the tenth convolutional layer, the output of the twelfth convolutional layer, and the output of the eighth convolutional layer, and then the concatenated feature map is passed to the attention mechanism Conv_ATT to extract key features; the implementation method of the attention mechanism Conv_ATT is as follows: the input feature map is subjected to a convolution operation to obtain a new feature representation; the output of the convolution operation is subjected to Perform batch normalization processing; perform nonlinear transformation on the convolution output using nn.SiLU(); add the SE attention mechanism to learn the importance of each feature channel and weight different channels of the feature map so that the network can pay more attention to important feature channels; in forward propagation, the input features are processed by convolution, batch normalization, activation function and attention mechanism to obtain a weighted feature map as output; the implementation method of the SE attention mechanism is as follows: the global average pooling layer self.avg_pool pools the features of each channel to obtain the average value of each channel; then through two linear layers and the activation function self.fc, learn to generate the attention weights of each channel; finally, multiply the original feature map x by the learned attention weights to obtain the weighted feature map.

[0009] Furthermore, the implementation method of the SPPCSPC_ATT module is as follows: multiple feature extraction and dimensionality reduction are performed on the input features through the convolutional layers self.cv1, self.cv3 and self.cv4; the feature map is pooled at different scales using the multi-scale maximum pooling layer self.m, and concatenated with the original feature x1; the concatenated feature y1 is further processed through two additional convolutional layers self.cv5 and self.cv6; at the same time, another convolutional layer self.cv2 is used to process the input features to obtain y2; finally, y1 and y2 are concatenated, further processed through self.cv7, and passed to the attention mechanism layer self.att for weighted processing to obtain the final feature representation.

[0010] Furthermore, the implementation method of the MP-2_ATT module is as follows: first, the input features are passed into the maximum pooling layer and the thirteenth convolutional layer, then the input of the fourteenth convolutional layer is the output of the maximum pooling layer, and the input of the fifteenth convolutional layer is the output of the thirteenth convolutional layer. Finally, the features obtained by the fourteenth convolutional layer and the fifteenth convolutional layer are connected using Concat_ATT.

[0011] Furthermore, the implementation method of the Concat_ATT module is as follows: in the init method: accept a parameter channel, which indicates the number of channels of the input feature; dimension indicates the dimension on which the concatenation is performed, and the default is 1; create an instance of the SEAttention class att, which is used to enhance the self-attention mechanism of the concatenated features; in the forward method: the input x is a feature list or feature tuple, containing multiple feature tensors; use torch.cat(x, self.d) to concatenate these feature tensors in the specified dimension self.d; then, input the concatenated feature tensor into the self-attention mechanism SEAttention to obtain the enhanced feature tensor.

[0012] Furthermore, the insulator defect detection method also includes the following steps: establishing a data set, using the open source data set InsulatorDataSet, Normal_Insulators contains normal insulators captured by drones, and Defective_Insulators contains defective insulators; preprocessing the images in the data set to convert them into yolo format.

[0013] Furthermore, the insulator defect detection method also includes the following steps: performing data enhancement on the data set, and the output of each training example includes the following operations: horizontal and vertical flipping, clockwise and counterclockwise 90° rotation, upside down, cropping, rotation, shearing, hue, saturation, brightness, exposure, blur, and noise.

[0014] Furthermore, the adjustment range during cropping is: minimum zoom 0%, maximum zoom 20%; the adjustment range during rotation is: angle of -15° to +15°; the adjustment range during shearing is: horizontal ±10°, vertical ±10°; the adjustment range of hue is: -15° to +15°; the adjustment range of saturation is: -25% to +25%; the adjustment range of brightness is: -15% to +15%; the adjustment range of exposure is: -10% to +10%; the adjustment range of blur is: less than or equal to 2.5 pixels; the adjustment range of noise is: up to 0.1% of pixels.

[0015] Furthermore, the insulator defect detection method also includes the following steps: setting the training parameters, Batch_size=8, lr0 is set to 0.01, lrf is set to 0.1, and epochs is set to 150.

[0016] Compared with the original YOLOv7 network model, the algorithm mAP@0.5 of the improved YOLOv7 network model in this application is improved by 5.1% to 99.6%, which has higher accuracy.

[0017] Based on the implementations provided in the above aspects, this application can also be further combined to provide more implementations. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical method of the embodiments of the present application, the drawings required for use in the embodiments are briefly introduced below.

[0019] Figure 1 This is the structural diagram of the original YOLOv7 network model;

[0020] Figure 2 This is the structural diagram of the improved YOLOv7 network model;

[0021] Figure 3 This is the structure diagram of the ELAN_Conv_ATT module;

[0022] Figure 4 This is the structure diagram of the ELAN_Sim_ATT module;

[0023] Figure 5 This is the structure diagram of the MP-2_ATT module;

[0024] Figure 6 This is a schematic diagram of the image after data enhancement;

[0025] Figure 7 This is the detection effect diagram of the original YOLOv7 network model;

[0026] Figure 8 for Figure 7 A partial enlarged view of

[0027] Fig. 9 This is the detection effect diagram of the improved YOLOv7 network model;

[0028] Fig.10 for Fig. 9 A partial enlarged view of . DETAILED DESCRIPTION

[0029] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to enable the scope of the present application to be fully communicated to those skilled in the art. If not specifically indicated, the technical means used in the embodiments are conventional means well known to those skilled in the art.

[0030] First, the original yolov7 algorithm is introduced: the original YOLOv7 network model mainly includes four parts: Input, Backbone, Neck, and Head. First, the image is pre-processed through a series of operations such as data enhancement in the input part, and then sent to the backbone network. The backbone network extracts features from the processed image; then, the extracted features are fused through the Neck module to obtain features of three sizes: large, medium, and small; finally, the fused features are sent to the detection head, and the results are output after detection. The architecture of the original YOLOv7 network model is as follows: Figure 1 As shown in Figure 2, the accuracy of the original YOLOv7 network model in insulator defect detection is low.

[0031] Therefore, this application improves the original YOLOv7 network model to obtain an improved YOLOv7 network model. The network architecture diagram of the improved YOLOv7 network model is as follows: Figure 2 shown.

[0032] Specifically, the present application replaces the first two ELAN modules in the backbone network of the original YOLOv7 network model with ELAN_Sim_ATT modules, replaces the last two ELAN modules in the backbone network of the original YOLOv7 network model with ELAN_Conv_ATT modules, replaces the SPPCSPC module in the head of the original YOLOv7 network model with an SPPCSPC_ATT module, replaces the two Concat modules in the head of the original YOLOv7 network model with Concat_ATT modules, and replaces the two MP-2 modules in the head of the original YOLOv7 network model with MP-2_ATT modules to obtain an improved YOLOv7 network model.

[0033] The improved YOLOv7 network model is used to identify whether an insulator string is missing, with high accuracy.

[0034] The following is an introduction to the various attention modules introduced in this application:

[0035] 1. ELAN_Conv_ATT module

[0036] 1.1 Introducing the se attention mechanism

[0037] SE attention mechanism (Squeeze-and-Excitation Networks) is an important mechanism that can enhance the relationship between neural network feature channels. This mechanism automatically learns to assign weights to each channel of the feature map, allowing the neural network to focus on feature channels that are useful for the current task while suppressing channels that are irrelevant to the task. First, in the squeeze stage, the input feature map is compressed using the global average pooling operation to obtain the average value of each channel, thereby compressing the channel information into a scalar.

[0038] Next, in the Excitation phase, a small neural network is introduced to learn the importance of feature channels. The network includes two linear layers for dimensionality reduction and dimensionality increase, and processes the output through an activation function, usually using nn.Sigmoid() to ensure that the output is between 0 and 1. The goal of this neural network is to generate attention weights for each channel, and by inputting the compressed feature channels into the network, a vector with the same number of input channels is finally generated, where each value represents the importance weight of the corresponding channel.

[0039] Finally, the original feature map is multiplied by the generated attention weight to obtain the weighted feature map. This allows the neural network to more effectively learn the importance of each feature channel, enhance the representation of features that are useful for the current task, and suppress the impact of features that are irrelevant to the task. The SE attention mechanism performs well in tasks such as image recognition and object detection, effectively improving the performance and generalization ability of the model.

[0040] 1.2 Implementation steps for improving SE attention mechanism

[0041] The global average pooling layer self.avg_pool pools the features of each channel to obtain the average value of each channel.

[0042] Then, through two linear layers and the activation function self.fc, learning generates the attention weights for each channel. These weights determine the contribution of each channel in the final output.

[0043] Finally, the original feature map x is multiplied by the learned attention weight to obtain the weighted feature map. This can enhance the features of important channels and suppress the features of unimportant channels, thereby improving the performance and expression ability of the model.

[0044] In general, the SE module effectively improves the performance of the model while keeping the model structure simple, especially when dealing with features with more complex inter-channel relationships.

[0045] 1.3Conv_ATT module implementation

[0046] Convolution operation (self.conv): A convolution layer used to extract input features. The input feature map is convolved to obtain a new feature representation.

[0047] Batch Normalization (self.bn): Batch normalization is performed on the output of the convolution operation, which helps improve the stability of the model and the training efficiency.

[0048] Activation function (self.act): Perform a nonlinear transformation on the convolution output. nn.SiLU() is used here, or other activation functions are selected based on the input parameters.

[0049] SE attention mechanism (self.att): An attention mechanism is added to learn the importance of each feature channel and weight different channels of the feature map so that the network can pay more attention to important feature channels and improve model performance.

[0050] Forward propagation: The input features are processed by convolution, batch normalization, activation function and attention mechanism to obtain the weighted feature map as output.

[0051] Fuseforward: Compared with standard forward propagation, the batch normalization operation is removed, and the input features are directly processed through the activation function and attention mechanism to obtain the fused output.

[0052] In order to make the detection results more accurate, this module uses forward propagation.

[0053] 1.4ELAN_Conv_ATT module implementation

[0054] First, we use 6 convolutional layers (Conv) to extract features. Then we concatenate these feature maps (Feature Maps) and finally introduce the attention mechanism (Conv_ATT) to improve the efficiency of object detection.

[0055] like Figure 3 As shown, first, the seventh convolutional layer 21 and the eighth convolutional layer 26 with two branches are used for feature extraction, followed by the input of the ninth convolutional layer 22 being the output of the seventh convolutional layer 21, the input of the tenth convolutional layer 23 being the output of the ninth convolutional layer 22, the input of the eleventh convolutional layer 24 being the input of the tenth convolutional layer 23, and the input of the twelfth convolutional layer 25 being the output of the eleventh convolutional layer 24. Finally, Concat is used to concatenate the output of the seventh convolutional layer 21, the output of the tenth convolutional layer 23, the output of the twelfth convolutional layer 25, and the output of the eighth convolutional layer 26, and then the concatenated feature map is passed into the attention mechanism Conv_ATT to extract key features.

[0056] 2.Conv_Sim_ATT

[0057] 2.1 Introduction of SimAM

[0058] Different from the existing channel / spatial attention modules, this module does not require additional parameters to derive 3D attention weights for feature maps. Specifically, based on the well-known neuroscience theory, an optimized energy function is proposed to mine the importance of neurons. A fast analytical solution is further derived for the energy function and it is shown that the analytical solution can be implemented with only a small amount of code. Another advantage of this module is that most operations are based on the defined energy function selection, avoiding excessive structural adjustments. Finally, the effectiveness and flexibility of the proposed attention module are verified on different tasks.

[0059] The core idea of ​​SimAM is that it introduces spatial information, which enables the model to establish more accurate associations between channels and spatial positions. This mechanism not only focuses on the relationship between features of different channels in the feature map, but also pays attention to their distribution in space. This comprehensive attention enables SimAM to better explore the intrinsic relationship between features, thereby improving the performance of the model.

[0060] 2.2 Improved SimAM attention mechanism implementation steps

[0061] This SimAM class implements the functionality of the adaptive modulation attention mechanism (Adaptive ModulationAttention).

[0062] (1) In the __init__ method:

[0063] The activation function is defined as Sigmoid, and a small constant e_lambda is set for numerical stability.

[0064] (2) In the forward method:

[0065] Takes in an input tensor x whose shape is [batch_size, channels, height, width].

[0066] First, calculate the mean of x in the width and height dimensions and broadcast it to each position to get the square of the difference between x and the mean.

[0067] (3) Next, the normalization coefficient for each position is calculated based on the square of the difference: sum the squares of all differences to obtain a total variance estimate.

[0068] The total variance estimate is divided by a small constant e_lambda and a bias term is added to obtain the normalization coefficient.

[0069] (4) The normalized coefficients are mapped to [0, 1] through the Sigmoid activation function, and the attention weight y is obtained.

[0070] These weights indicate the amount of attention that each position should receive, with larger values ​​indicating more importance.

[0071] (5) Finally, the input tensor x is multiplied by the obtained attention weight to obtain the enhanced feature tensor for subsequent task processing.

[0072] The role of this attention mechanism is to enable the neural network to dynamically focus on important feature information through adaptive modulation, thereby improving the performance and generalization ability of the model in complex tasks.

[0073] 2.3Conv_Sim_ATT module implementation

[0074] The Conv_Sim_ATT class is a convolution module with an adaptive modulation attention mechanism (Adaptive ModulationAttention).

[0075] (1) In the __init__ method:

[0076] Use nn.Conv2d to define a convolutional layer that accepts c1 input channels, outputs c2 channels, uses a convolution kernel of size k, a stride of s, padding of p, grouping of g, and does not include a bias.

[0077] Define a batch normalization layer nn.BatchNorm2d to normalize the convolution output.

[0078] Use nn.SiLU() (or other activation function) as the activation function.

[0079] Create an instance of SimAM att, which represents the attention mechanism of adaptive modulation.

[0080] (2) In the forward method:

[0081] The input x is first processed by the convolution layer, batch normalization layer and activation function to obtain the feature tensor.

[0082] Then, the feature tensor is passed to the adaptive modulation attention mechanism SimAM to obtain the attention-modulated feature tensor, that is, the enhanced feature representation.

[0083] (3) In the fuseforward method:

[0084] The input x is first processed by the convolution layer and activation function to obtain the feature tensor.

[0085] Then, this feature tensor is passed to the adaptive modulation attention mechanism SimAM to obtain the attention-modulated feature tensor.

[0086] By introducing an adaptively modulated attention mechanism, this module enables the model to dynamically adjust weights according to the importance of features, which increases the model's attention to features and helps capture important feature information, thereby improving the performance and generalization ability of the model.

[0087] 2.4ELAN_Sim_ATT module implementation

[0088] First, we extract features through 6 convolutional layers (Conv), then concatenate these feature maps (Concat), and finally introduce the attention mechanism to improve the efficiency of object detection.

[0089] like Figure 4 As shown, first, there are two branches of the first convolution layer 11 and the second convolution layer 12 for feature extraction, followed by the input of the third convolution layer 13 being the output of the first convolution layer 11, the input of the fourth convolution layer 14 being the output of the third convolution layer 13, the input of the fifth convolution layer 15 being the input of the fourth convolution layer 14, and the input of the sixth convolution layer 16 being the output of the fifth convolution layer 15. Finally, Concat is used to concatenate the output of the first convolution layer 11, the output of the second convolution layer 12, the output of the fourth convolution layer 14, and the output of the sixth convolution layer 16, and then the concatenated feature map is passed to the attention mechanism Conv_Sim_ATT to extract key features.

[0090] 3.MP-2_ATT

[0091] 3.1Concat_ATT module implementation

[0092] The Concat_ATT class is a feature fusion module based on the self-attention mechanism.

[0093] (1) In the __init__ method:

[0094] Accepts a parameter channel, which indicates the number of channels of the input feature.

[0095] Dimension indicates the dimension on which the concatenation is performed. The default value is 1.

[0096] An instance of the SEAttention class att is created to enhance the self-attention mechanism of the concatenated features.

[0097] (2) In the forward method:

[0098] The input x is a feature list (or feature tuple) containing multiple feature tensors.

[0099] Use torch.cat(x, self.d) to concatenate these feature tensors at the specified dimension self.d.

[0100] Then, the concatenated feature tensor is input into the self-attention mechanism SEAttention to obtain the enhanced feature tensor.

[0101] The function of this module is to concatenate multiple feature tensors in a specified dimension and enhance the representation of these concatenated features through the self-attention mechanism. The self-attention mechanism can make the model pay more attention to important feature parts, thereby improving the performance and representation ability of the model.

[0102] 3.2MP-2_ATT module implementation

[0103] MaxPooling is a commonly used pooling operation, usually used in convolutional neural networks (CNN). Its main function is to reduce the spatial dimension of the feature map and the number of parameters while retaining important feature information. It is then combined with convolutional feature extraction, and finally the attention mechanism is added to improve the detection efficiency of the model.

[0104] like Figure 5 As shown, the input features are first passed into the maximum pooling layer 31 and the thirteenth convolutional layer 33, then the input of the fourteenth convolutional layer 32 is the output of the maximum pooling layer 31, and the input of the fifteenth convolutional layer 34 is the output of the thirteenth convolutional layer 33. Finally, the features obtained by the fourteenth convolutional layer 32 and the fifteenth convolutional layer 34 are connected using Concat_ATT.

[0105] 4.SPPCSPC_ATT module implementation

[0106] The main idea of ​​this model is:

[0107] (1) Multiple feature extraction and dimensionality reduction are performed on the input features through a series of convolutional layers self.cv1, self.cv3 and self.cv4.

[0108] (2) Use the multi-scale maximum pooling layer self.m to perform pooling operations on the feature map at different scales and concatenate it with the original feature x1.

[0109] (3) The concatenated feature y1 is further processed by two additional convolutional layers self.cv5 and self.cv6.

[0110] (4) At the same time, another convolutional layer self.cv2 is used to process the input features to obtain y2.

[0111] (5) Finally, y1 and y2 are concatenated, further processed by self.cv7, and passed to the attention mechanism layer self.att for weighted processing to obtain the final feature representation. The overall idea of ​​this model is to use multiple convolutional layers, maximum pooling layers, and attention mechanism layers, combining information of different scales and features, so as to extract more representative and critical features to improve the efficiency and accuracy of target detection.

[0112] 5. Experimental results and analysis

[0113] 5.1 Dataset and Preprocessing

[0114] This dataset uses the open source dataset InsulatorDataSet. Normal_Insulators contains normal insulators captured by drones. The number of normal insulator images is 600. Defective_Insulators contains defective insulators. The number of defective insulator images is 248. Then it is preprocessed and converted to YOLO format.

[0115] Data Augmentation

[0116] The purpose of data augmentation is to enable machine learning models to better learn the diversity and changes of data while reducing the risk of overfitting by performing various transformations and operations on the original data. Doing so can improve the performance of the model on unseen data, increase the robustness and generalization ability of the model, save data acquisition costs, and ultimately improve the performance of the model. Therefore, when this dataset is augmented, the output of each training example includes the following operations: horizontal and vertical flipping, clockwise and counterclockwise 90° rotation, upside down, cropping (minimum scale 0%, maximum scale 20%), rotation (-15° to +15°), shearing (horizontal ±10°, vertical ±10°), hue (-15° to +15°), saturation (-25% to +25%), brightness (-15% to +15%), exposure (-10% to +10%), blur (maximum 2.5 pixels), noise (up to 0.1% of pixels).

[0117] Some images after data augmentation are as follows Figure 6 As shown in the figure, Perprocessed means that the original image is the image to be data enhanced, Vertical means that the original image is rotated vertically, and horizontal means that the original image is rotated horizontally. Clockwise means that the original image is rotated clockwise, and counter-clockwise means that the original image is rotated counterclockwise.

[0118] 5.3 Training parameter settings

[0119] During training, Batch_size=8, lr0 is set to 0.01, lrf is set to 0.1, and epochs is set to 150.

[0120] Software, Hardware / Systems Configuration System Windows 10 cpu i5-12400f GPU GeForce RTX 4060 RAM 32GB Development Languages Python 3.11 Deep Learning Framework Pytorch 2.2.0 Torchvision 0.17.0

[0121] 5.4 Comparative Experiment

[0122] The results show that compared with the original YOLOv7 algorithm, the algorithm of the present invention improves mAP@0.5 by 5.1% to 99.6%. In order to verify the detection effect of the present invention, data augmented images are used for detection. Figure 7 and Figure 8 This is the detection effect of the original YOLOv7. Fig. 9 and Fig.10 This is a diagram of the detection effect after a series of module improvements in the present invention. The results show that the improved detection method significantly improves the detection accuracy and reduces the missed detection rate.

[0123] Insulators are one of the key infrastructures for power transmission, and the reliable operation of their equipment is crucial to ensuring power supply. However, due to the characteristics of the equipment itself and the complexity of the environment in which it is located, its detection brings challenges such as target overlap, large size differences, small targets, and imbalanced categories. In response to these challenges, an insulator defect detection method based on an improved YOLOv7 algorithm is proposed. This method improves the accuracy and efficiency of the insulator defect detection algorithm by improving the YOLOv7 model.

[0124] This application aims at the defect identification problem of insulators, a key component of transmission lines, and provides a new technology based on YOLOv7 with an attention mechanism. It introduces the ELAN_Sim_ATT, ELAN_Conv_ATT, SPPCSPC_ATT, and MP-2_ATT attention modules to enhance the overall model's attention to fuzzy features and small target features. The experimental results verify the effectiveness of this method in intelligent monitoring of line equipment in complex transmission environments, and provide an effective solution to ensure the reliability of power supply. The improved YOLOv7 network model has high accuracy and reliability when detecting insulator defects, and has important practical significance and application prospects in improving the safety and reliability of transmission lines.

[0125] This application refers to the open source insulator defect detection dataset for expansion. These image data contain the diversity and complexity of different insulator defects, providing sufficient data support for subsequent model training. Next, this application uses yolov7 as the basis of the recognition model. The addition of the attention mechanism provides powerful feature learning capabilities, which can automatically learn and extract key features in the image, and has excellent performance for complex defect recognition tasks.

[0126] In the model training stage, this application uses a large-scale insulator image dataset to train and optimize the deep learning model. Through repeated iterative training, this application continuously adjusts the parameters and structure of the model to make it better adapt to the task of insulator defect identification. At the same time, in order to improve the generalization ability and stability of the model, this application uses data enhancement, batch normalization and other technologies to preprocess and optimize the data.

[0127] After training, the deep learning model of this application has achieved remarkable results in the task of insulator defect identification. The model can accurately identify insulator defects. Compared with traditional manual inspection methods, the technology of this application has higher accuracy and efficiency, greatly improving the automation and reliability of insulator defect identification.

[0128] In summary, this application proposes a defect recognition technology for insulators, a key component of power transmission lines, based on the yolov7 technology with an attention mechanism. A large number of experiments have shown that this technology has high accuracy and reliability, and has important practical significance and application prospects in improving the safety and reliability of power transmission lines.

[0129] This application proposes an insulator defect recognition method based on the improved YOLOv7, introduces ELAN_Sim_ATT, ELAN_Conv_ATT, SPPCSPC_ATT, MP-2_ATT, and improves the network of the original YOLOv7 model. Compared with the original YOLOv7 model, the recognition accuracy is improved by 5.1%. Compared with the yolov7 convolutional neural network algorithm, the improved YOLOv7 model has higher accuracy, efficiency, and robustness. While achieving high-precision recognition of insulator defects, it also takes into account the detection rate, and has certain advancement and industrial applicability in the field of unmanned aerial vehicle inspection of insulators. This application focuses specifically on the identification of insulator strings and their missing parts using images taken by drones.

[0130] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct a computing device or a computing device cluster to execute the above-mentioned insulator defect detection method.

[0131] The embodiment of the present application also provides a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computing device, the process or function described in the embodiment of the present application is generated in whole or in part. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computing device or a data center to another website site, a computing device or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer program product can be a software installation package. When any of the aforementioned insulator defect detection methods is required, the computer program product can be downloaded and executed on a computing device or a computing device cluster.

[0132] The descriptions of the processes or structures corresponding to the above-mentioned figures have different emphases. For parts that are not described in detail in a certain process or structure, please refer to the relevant descriptions of other processes or structures.

[0133] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A method for detecting insulator defects, characterized in that: The steps include: The original YOLOv7 network model is improved by replacing the first two ELAN modules in the backbone network of the original YOLOv7 network model with ELAN_Sim_ATT modules, replacing the last two ELAN modules in the backbone network of the original YOLOv7 network model with ELAN_Conv_ATT modules, replacing the SPPCSPC module in the head of the original YOLOv7 network model with the SPPCSPC_ATT module, replacing the two Concat modules in the head of the original YOLOv7 network model with the Concat_ATT module, and replacing the two MP-2 modules in the head of the original YOLOv7 network model with the MP-2_ATT module to obtain an improved YOLOv7 network model; The improved YOLOv7 network model is used to identify whether the insulator string is missing; The implementation method of the ELAN_Sim_ATT module is as follows: first, the first convolution layer (11) and the second convolution layer (12) with two branches are used for feature extraction, then the input of the third convolution layer (13) is the output of the first convolution layer (11), the input of the fourth convolution layer (14) is the output of the third convolution layer (13), the input of the fifth convolution layer (15) is the input of the fourth convolution layer (14), and the input of the sixth convolution layer (16) is the output of the fifth convolution layer (15), and finally, Concat is used to splice the output of the first convolution layer (11), the output of the second convolution layer (12), the output of the fourth convolution layer (14) and the output of the sixth convolution layer (16), and then the spliced ​​feature map is passed to the attention mechanism Conv_Sim_ATT to extract key features; The implementation method of the ELAN_Conv_ATT module is as follows: first, the seventh convolution layer (21) and the eighth convolution layer (26) with two branches are used for feature extraction, then the input of the ninth convolution layer (22) is the output of the seventh convolution layer (21), the input of the tenth convolution layer (23) is the output of the ninth convolution layer (22), the input of the eleventh convolution layer (24) is the input of the tenth convolution layer (23), and the input of the twelfth convolution layer (25) is the output of the eleventh convolution layer (24), and finally, Concat is used to splice the output of the seventh convolution layer (21), the output of the tenth convolution layer (23), the output of the twelfth convolution layer (25) and the output of the eighth convolution layer (26), and then the spliced ​​feature map is passed to the attention mechanism Conv_ATT to extract key features; The implementation method of the SPPCSPC_ATT module is as follows: multiple feature extraction and dimensionality reduction are performed on the input features through convolutional layers self.cv1, self.cv3 and self.cv4; the multi-scale maximum pooling layer self.m is used to perform pooling operations of different scales on the feature map, and it is spliced ​​with the original feature x1; the spliced ​​feature y1 is further processed through two additional convolutional layers self.cv5 and self.cv6; at the same time, another convolutional layer self.cv2 is used to process the input features to obtain y2; finally, y1 and y2 are spliced, further processed through self.cv7, and passed to the attention mechanism layer self.att for weighted processing to obtain the final feature representation; The implementation method of the Concat_ATT module is as follows: in the init method: accept a parameter channel, which indicates the number of channels of the input feature; dimension indicates the dimension on which the concatenation is performed, and the default value is 1; create an instance of the SEAttention class att, which is used to enhance the self-attention mechanism for the concatenated features; in the forward method: input x is a feature list or feature tuple, containing multiple feature tensors; use torch.cat(x, self.d) to concatenate these feature tensors in the specified dimension self.d; then, input the concatenated feature tensor into the self-attention mechanism SEAttention to obtain the enhanced feature tensor; The implementation method of the MP-2_ATT module is as follows: first, the input features are passed into the maximum pooling layer (31) and the thirteenth convolutional layer (33), then the input of the fourteenth convolutional layer (32) is the output of the maximum pooling layer (31), and the input of the fifteenth convolutional layer (34) is the output of the thirteenth convolutional layer (33), and finally, the features obtained by the fourteenth convolutional layer (32) and the fifteenth convolutional layer (34) are connected by Concat_ATT.

2. The insulator defect detection method according to claim 1, characterized in that: The implementation method of the attention mechanism Conv_Sim_ATT is as follows: in the init method: use nn.Conv2d to define a convolution layer, receive c1 input channels, output c2 channels, use a convolution kernel of size k, a step size of s, a padding of p, a grouping number of g, and no bias, define a batch normalization layer nn.BatchNorm2d, normalize the convolution output, use nn.SiLU() as the activation function, and create an instance of SimAM att, which represents the adaptively modulated attention mechanism; In the forward method, the input x is first processed by the convolution layer, batch normalization layer and activation function to obtain the feature tensor, and then the feature tensor is passed to the adaptive modulation attention mechanism SimAM to obtain the feature tensor modulated by attention, that is, the enhanced feature representation; in the fuseforward method, the input x is first processed by the convolution layer and activation function to obtain the feature tensor, and then the feature tensor is passed to the adaptive modulation attention mechanism SimAM to obtain the feature tensor modulated by attention; The implementation method of SimAM is as follows: in the init method: the activation function is defined as Sigmoid, and a small constant e_lambda is set for numerical stability; in the forward method: the input tensor x is received, and its shape is [batch_size, channels, height, width]; first, the mean of x in the width and height dimensions is calculated, and it is broadcasted to each position to obtain the square of the difference between x and the mean; then, the normalization coefficient of each position is calculated based on the square of the difference: the squares of all differences are summed to obtain a total variance estimate; Divide the total variance estimate by a small constant e_lambda and add the bias term to get the normalized coefficient; map the normalized coefficient to [0,1] through the Sigmoid activation function and get the attention weight y; Finally, the input tensor x is multiplied by the obtained attention weight to obtain the enhanced feature tensor for subsequent task processing.

3. The insulator defect detection method according to claim 1, characterized in that: The implementation method of the attention mechanism Conv_ATT is as follows: the input feature map is convolved to obtain a new feature representation; the output of the convolution operation is batch normalized; the convolution output is nonlinearly transformed using nn.SiLU(); the SE attention mechanism is added to learn the importance of each feature channel and weight different channels of the feature map so that the network pays more attention to important feature channels; Propagation, the input features are processed by convolution, batch normalization, activation function and attention mechanism to obtain the weighted feature map as output; The implementation method of the SE attention mechanism is as follows: the global average pooling layer self.avg_pool pools the features of each channel to obtain the average value of each channel; then, through two linear layers and the activation function self.fc, the attention weight of each channel is learned and generated; finally, the original feature map x is multiplied by the learned attention weight to obtain the weighted feature map.

4. The insulator defect detection method according to claim 1, characterized in that: The insulator defect detection method further comprises the following steps: Create a data set using the open source data set InsulatorDataSet. Normal_Insulators contains normal insulators captured by drones, and Defective_Insulators contains defective insulators. Preprocess the images in the data set and convert them into the YOLO format.

5. The insulator defect detection method according to claim 1, characterized in that: The insulator defect detection method further comprises the following steps: The dataset is augmented with data, and the output of each training example includes the following operations: horizontal and vertical flip, 90° clockwise and counterclockwise rotation, upside down, crop, rotate, shear, hue, saturation, brightness, exposure, blur, and noise.

6. The insulator defect detection method according to claim 1, characterized in that: The adjustment range when cropping is: minimum zoom 0%, maximum zoom 20%; the adjustment range when rotating is: angle -15° to +15°; the adjustment range when shearing is: horizontal ±10°, vertical ±10°; the adjustment range of hue is: -15° to +15°; the adjustment range of saturation is: -25% to +25%; the adjustment range of brightness is: -15% to +15%; the adjustment range of exposure is: -10% to +10%; the adjustment range of blur is: less than or equal to 2.5 pixels; the adjustment range of noise is: up to 0.1% of the pixel.

7. The insulator defect detection method according to claim 1, characterized in that: The insulator defect detection method also includes the following steps: setting training parameters, Batch_size=8, lr0 is set to 0.01, lrf is set to 0.1, and epochs is set to 150.

Citation Information

Patent Citations

  • Insulator defect detection method based on improved Center Net network

    CN115239681A

  • Lightweight insulator defect detection method based on improved YOLOv7-tiny

    CN117392102A