# Transmission Lines Insulator State Detection Method Based on Deep Learning
## 2 Materials and Methods  
The transmission lines insulator state detection method based on BRA-CBS with content-aware up-sampling proposed in this paper is an enhancement of the YOLOv7 [20] framework proposed by [PERSON] et al. in 2022. The YOLOv7 Backbone is composed of three max-pooling down-sampling and CBS modules (MPs), along with four Extended Efficient Layer Aggregation Networks (E-ELANs) stacked together. Its Neck consists of a Path Aggregation Network (PANet) [21] that performs bi-directional feature fusion across three scales derived from the backbone network. The Head utilizes a reparameterized convolution (RepConv) [22], allowing a trade-off between speed and accuracy during training.  
However, the baseline YOLOv7 network has limitations when it comes to retaining feature information for small targets during the feature fusion stage. Additionally, its nearest-neighbor interpolation up-sampling can lead to the loss of meaningful features when fusing different scales. The original YOLOv7's CIOU loss function also does not adequately address the balance between high- and low-quality samples, potentially impacting detection accuracy. By introducing the BRA-CBS module and content-aware up-sampling, our improved method aims to mitigate these issues, enhancing small-target feature retention and providing a more robust approach to insulator state detection. The structure is shown in Figure 1.  
The model retains the original backbone network structure composed of MPs and E-ELAN. The E-ELAN employs group convolution to increase the channels and cardinality of computational blocks, improving the network's learning capacity by expanding, shuffling, and merging cardinality, all while preserving the integrity of the original gradient pathways.  
Figure 1: Structure diagram of improved YOLOv7.  
It only modifies the architecture of computational blocks while leaving the structure of transition layers entirely unchanged. Assuming an input of a 640 \(\times\) 640 \(\times\) 3 RGB image, the feature map size is adjusted to 20 \(\times\) 20 \(\times\) 1024 after passing through the backbone network. Subsequently, the SPPCSPC module reduces the channel number to 512, adapting the method to different resolution images by using max pooling to obtain different receptive fields. Following this, the feature maps are enlarged by two content-aware feature reassembly up-sampling operators and concatenated with the feature maps extracted from two scales of the backbone network, yielding feature map groups of sizes 40 \(\times\) 40 \(\times\) 512 and 80 \(\times\) 80 \(\times\) 256. Then, the PANet's bidirectional feature fusion network performs feature fusion from large to small scales. The fused features are then input into the BRA-CBS module, which incorporates a dual-level routing attention mechanism, producing feature map groups of sizes 20 \(\times\) 20 \(\times\) 512, 40 \(\times\) 40 \(\times\) 256, and 80 \(\times\) 80 \(\times\) 128. Finally, the features are fed into the Rep module for reparameterized convolution. The specific structures of each module are detailed in Figure 1's lower section.