# High-Accuracy Insulator Defect Detection for Overhead Transmission Lines Based on Improved YOLOv5
## 2 Materials and Methods
### Improved YOLOv5 Algorithm
#### 2.2.1 Backbone Network  
The original backbone network is sliced, and three scale feature maps of \(128\times 80\times 80\), \(256\times 40\times 40\), and \(512\times 20\times 20\) are obtained by threefold downsampling. The Ghost lightweight module is added to the backbone network to replace the cross-stage partial (CSP) [29] convolution module in the original backbone network and reduce the computational overhead of the network model. The Ghost module mainly uses the linear operation method with less computation to replace the original convolution operation while ensuring the performance of the network detection accuracy. The feature map is obtained through the \(3\times 3\) convolution kernel, and the depthwise convolution performs the linear operation  
Figure 1: Original YOLOv5 network model detection block diagram. on each channel of the feature map to expand the channel, which is equivalent to the hierarchical convolution processing of the input feature map. The backbone network structure is shown in Figure 2. The network designed in this paper makes full use of the feature map generated during the sampling process on the backbone network. Based on the original YOLOv5 three-layer detection layer, the feature map with a scale of 64 \(\times\) 160 \(\times\) 160 generated by downsampling is combined with the same scale feature map of the head to form a minimum scale detection layer. Among them, the internal structure diagram of each module in the backbone network of Figure 2 is further explained in detail in Figure 3.  
Figure 3: Internal structure diagram of each module in the backbone network. (**a**) The internal structure of Ghost1_X module in the backbone network; (**b**) the internal structure of CBL module in the backbone network; (**c**) the internal structure of Ghost2_X module in the backbone network; (**d**) the internal structure of Ghost module in the backbone network; (**e**) The internal structure of SE module in the backbone network. Figure 2: Improving the backbone network of YOLOv5. Figure 3 is the internal structure of each module of the backbone network. As shown in Figure 3a, 1 in the Ghost1_X module is the convolution step size, and X is the number of times the module is repeated. GM in Ghost1_X module represents the Ghost lightweight module in (d), and BN represents batch normalization to speed up the network proficiency. RU represents the ReLu activation function to alleviate network overfitting. The add module combines the output of the previous layer with the output of this layer in the form of residual edges. As shown in Figure 3b, the CBL module is composed of three network layers: Conv, batch normalization, and Leaky ReLu. The LRU in the CBL module refers to the Leaky ReLu. As shown in Figure 3c, in the Ghost2_X module, 2 in the Ghost2_X module is the convolution step size, and X is the number of times the module is repeated. DWConv refers to depthwise separable convolution. As shown in Figure 3d, in the Ghost module, GConv refers to group convolution. As shown in Figure 3e, in the squeeze-and-excitation (SE) module, global average pooling is used to obtain global features, and the sigmoid activation function is used to introduce the nonlinear relationship between channels; FC refers to fully connected layers. Among them, the SE attention mechanism finally obtained the weight matrix calculation process as follows [30]:  
The calculation is mainly divided into two parts: the first is to compress the feature map to obtain a matrix containing only channel information. \[z_{c}=F_{sq}(u_{c})=\frac{1}{H\times W}\sum_{i=1}^{H}\sum_{j=1}^{W}u_{c}(i,j), \tag{1}\]  
In the formula, \(H\) and \(W\) are the height and width of the input feature map, respectively, and \(u_{c}\) is the feature map with \(c\) input channels. The second is to weigh each channel.