# EER-DETR: An Improved Method for Detecting Defects on the Surface of Solar Panels Based on RT-DETR
## 3 Algorithm
### Eer-Detr
#### 3.2.1 RepaNet  
In order to further enhance the backbone's ability to extract multi-scale features, a structure re-parameterization module, WDBB, is added after the hierarchical stacked convolution and pooling structure to form a new feature extraction network, RepaNet, providing feature maps with more detailed information for the detection head. Taking an input image of size 640 \(\times\) 640 as an example, the original RT-DETR algorithm generated feature maps of sizes 160 \(\times\) 160, 80 \(\times\) 80, 40 \(\times\) 40 and 20 \(\times\) 20 through multiple downsampling operations. In the defect detection of photovoltaic panels, due to the small size of the defect targets, after downsampling, the information is further compressed, resulting in a severe loss of small target information on low-resolution feature maps, which easily leads to missed detection problems. In the new feature extraction network, RepaNet, the WDBB (Wide Diverse Branch Block) module [26], as a key component, is composed of 1 \(\times\) 1 convolution, sequential 1 \(\times\) 1-K \(\times\) K convolution, average pooling branch, and asymmetric 1 \(\times\) K and K \(\times\) 1 convolution in the training stage. As shown in Figure 3, in the training stage, the WDBB module first performs identity transformation to generate multiple K \(\times\) K convolution  
Figure 2: EER-DETR network structure diagram. branches. This transformation involves expanding them by padding zeros around the 1 \(\times\) 1 and K \(\times\) K convolutions, effectively converting them into special 3 \(\times\) 3 convolution kernels. Similarly, average pooling can be regarded as a parameteally equal convolution kernel. Also, 1 \(\times\) 3 and 3 \(\times\) 1 convolutions can be expanded into 3 \(\times\) 3 convolutions by padding zeros at specific positions. The consecutive 1 \(\times\) 1 and K \(\times\) K convolutions can be transformed into a single K \(\times\) K convolution kernel using Formula (1) in the original paper [27]. In the second step, by taking advantage of the linear addition characteristic of the convolution module, multiple convolution kernels are added together to obtain a single K \(\times\) K convolution kernel for model inference and deployment. Equations (1) and (2) demonstrate this additive principle, where O' represents the output of the convolution kernel, I represents the input image or feature, F represents the convolution kernel, and b is the offset after re-parameterization of the convolution layer. By decomposing and binding different convolutions, the detection performance is improved. \[I@\mathbf{F^{\prime}}+\mathrm{REP}(\mathbf{\theta^{\prime}})^{\prime}=(I@ \mathbf{F^{(1)}}+\mathrm{REP}(\mathbf{b^{(1)}}))@\mathbf{F^{(2)}}+\mathrm{REP} (\mathbf{b^{(2)}}) \tag{1}\]  
\[I@\mathbf{F^{(1)}}+I@\mathbf{F^{(2)}}=I@(\mathbf{F^{(1)}}+\mathbf{F^{(2)}}) \tag{2}\]  
Figure 3: **(a)** The original branch of WDBB, **(b)** the K \(\times\) K convolutional branch after unit transformation. We improved the BasicBlock in the traditional ResNet to BasicBlock_WDBB, which constitutes our RepaNet. In the BasicBlock, there are two 3 \(\times\) 3 convolutions, and the residuals are directly added on the single main path. The residual calculation process is as shown in Equation (3). BasicBlock_WDBB is a multi-branch convolution (3 \(\times\) 3, 5 \(\times\) 5, depthwise separable), and diversified branches are parallelly processed for dynamic weighting. The calculation process is as shown in Equation (4). \[\mathrm{y}=\mathrm{x}+\mathrm{F(x)},\mathrm{F(x)}=\mathrm{Conv}_{3\times 3} \ \mathrm{(ReLU}\ \mathrm{(Conv}_{3\times 3}(\mathrm{x}))) \tag{3}\]  
\[\mathrm{F(x)}=\sum_{i=1}^{N}w_{i}\times Branch_{i}(\mathrm{x}),\ w_{i}=\sigma \mathrm{(Attention(GlobalPool(x)))} \tag{4}\]  
Therefore, the newly obtained RepaNet feature extraction network is more conducive to the convergence of the network and the learning of more information during the training of small targets.