# RML-YOLO: An Insulator Defect Detection Method for UAV Aerial Images
## 2 Materials and Methods
### Design of Multi Scale Feature Extraction Pyramid Network
The entire process is described as Equations (1) and (2), where \(F_{l}\) refers to the input large-size feature map, \(C\) refers to the number of channels, \(X_{1}\) and \(X_{2}\) refer to the two divided parts of features, \(AvgPool\) refers to average pooling, \(Split\) refers to the feature splitting operation, \(Concat\) refers to the feature concatenation operation, \(Conv\) refers to convolution, and \(MaxPool2d\) refers to maximum pooling. \[[X_{1},X_{2}]=Split(AvgPool(F_{l}),C/2) \tag{1}\]  
\[F_{l}^{\prime}=Concat(Conv(X_{1}),Conv(MaxPool2d(X_{2}))) \tag{2}\]  
For the medium-scale feature, perform pointwise convolution so that it can effectively mix the channel information together, which helps to enrich the feature expression. After processing, the size of the feature map becomes \((C/2,H,W)\). The entire process is described as Equation (3), where \(F_{m}\) is the input medium-scale feature tensor, and \(F_{m}^{\prime}\) refers to the feature tensor of \(F_{m}\) after convolution processing. \[F_{m}^{\prime}=Conv(F_{m}) \tag{3}\]  
For the small-scale feature map, an upsampling operation is first applied. This step increases the spatial resolution, allowing the feature map to capture more detailed spatial information, which is beneficial for subsequent feature fusion. Following the upsampling, a \(1\times 1\) convolution is employed to modify the channel dimensionality while keeping the spatial dimensions unchanged. This adjustment aligns the feature map's channel count with those of other scales, making it more compatible for fusion. Upon completion of these operations, the processed small-scale feature map has a final size of \((C/2,H,W)\). The mathematical formulation of this procedure is expressed as follows:  
\[F_{s}^{\prime}=Conv(Upsample(F_{s})) \tag{4}\]  
where \(F_{s}\) refers to the input small-size feature map, and \(F_{s}^{\prime}\) refers to the feature map of \(F_{s}\) after upsampling and convolution processing. After processing the large-, medium-, and small-sized feature maps, perform concatenation. Through the concatenation operation, the model can leverage multi-scale information to create a more complete information representation and enhance its ability to handle complex scenes. The concatenated feature map contains information at different levels, enabling the model to more effectively capture the diversity of objects. The specific process is as follows:  
\[X_{sf}=Concat(F_{l}^{\prime},F_{m}^{\prime},F_{s}^{\prime}) \tag{5}\]The second half of the TSFF module is an inception-style network. It consists of a set of parallel depthwise convolutions. Each convolution kernel size corresponds to different receptive fields, enabling the model to capture spatial features of different scales. At the same time, using depthwise convolutions can effectively reduce the amount of calculation and parameters while retaining a strong feature extraction ability. Then use \(1\times 1\) convolution to integrate features of different receptive field sizes, thereby capturing broader contextual information without compromising the integrity of local textures. Finally, perform residual connection between the scale-fused features and the multi-scale extracted features. Through this residual connection, the network retains the original feature information while learning convolutional features, so that it can better capture and represent the details and high-level semantic information of the input data. The process is as follows:  
\[Z_{dw}=Conv(X_{sf}+\sum_{4}^{m=1}DWConv_{k^{(m)}\times k^{(m)}}\left(X_{sf} \right)) \tag{6}\]  
\[P=X_{sf}+Z_{dw} \tag{7}\]  
\(DWConv_{k^{(m)}\times k^{(m)}}\) is the context feature extracted by the \(m\)-th \(k^{(m)}\times k^{(m)}\) depthwise convolution (DWConv). In our experiment, we set \(k^{(m)}=(m+1)\times 2+1,m=1,\ldots 4\). \(Z_{dw}\) as the output feature after multi-scale feature extraction and \(P\) as the feature after residual concatenation.