# High-Accuracy Insulator Defect Detection for Overhead Transmission Lines Based on Improved YOLOv5
## 2 Materials and Methods
### Improved YOLOv5 Algorithm
#### 2.2.2 CRF Receptive Field Module  
Due to the small receptive field in the shallow feature map, it is not conducive to large target detection, and the large receptive field in the deep feature map is not conducive to small target detection. In this paper, we design the channel receptive field block receptive field module to enhance the receptive field of the network while introducing the residual edges of the channel attention mechanism to achieve deep features in a lightweight convolutional network by designing the network mechanism.  
As shown in Figure 4, for the input feature map, the number of feature map channels is reduced by the convolution layer of \(1\times 1\) to reduce the computational overhead. Then, \(1\times 1\), \(3\times 3\), and \(5\times 5\) convolution kernels of different sizes are used to form a convolution layer of three branches to obtain receptive fields of different sizes, obtain more detailed feature information, and form receptive fields of different scales. Connect the dilated convolution corresponding to the expansion rate, and set the expansion rate as \(1\), \(3\), and \(5\), respectively. The convolution kernel is a \(3\times 3\) dilated convolution. By setting different expansion rates on different scale receptive fields, the eccentricity of each branch is obtained. Based on ensuring the resolution, the receptive field is increased, the discrimination ability of feature information is improved, and all branches are connected by Concat function.  
The designed channel attention is embedded into the receptive field module in the form of residual edges. The designed channel attention mechanism first performs downsampling through adaptive pooling to compress the feature map. The embedded channel attention measures the features captured by the convolution kernel from different channels, effectively retaining data information and reducing calculation parameters.  
Calculation of receptive field size for each layer:  
\[R_{i+1}=R_{i}+(K_{i+1}-1)\times S_{i}, \tag{3}\]  
In the formula, \(R\) is the receptive field size of the convolution layer, \(i\) represents the number of different convolution layers, \(S_{i}\) is the step size of the convolution kernel of the \(i\) layer, and \(K_{i}\) is the size of the convolution kernel of the \(i\) layer.  
The CRF receptive field module designed in this paper uses dilated convolution. For the calculation of the size of the dilated convolution receptive field:  
\[R_{i+1}=R_{i}+(K_{i+1}-1)\times S_{i}\times D_{i+1}, \tag{4}\]  
In the formula, \(D\) is the dilation rate of the hole convolution. The output of the network model to the input of each network layer is marked as 0\(\sim\)-\(i\), and the receptive field of the highest output layer is recorded as \(R_{0}\). The size of the receptive field of each layer is obtained by recursion layer by layer. When the \(R_{0}\) value is 1, the convolution kernel size is 3 \(\times\) 3, the step size is 2, and the void rate is 2; the first layer receptive field \(R_{1}\) value is 9.