# EER-DETR: An Improved Method for Detecting Defects on the Surface of Solar Panels Based on RT-DETR
## 3 Algorithm
### Eer-Detr
#### 3.2.3 Eucb  
During the upsampling process, nn.Upsample employs a simple interpolation method for upsampling, aiming to restore the low-resolution feature maps to higher resolutions. However, interpolation merely estimates the values of new pixels without any additional feature enhancement or learning process. During the upsampling process, especially for small target defects, the low-resolution feature maps may lose some details and high-frequency information, making the upsampled feature maps unable to effectively restore the details of the defects, thereby affecting the accuracy of detection. Specifically, in the defect detection of photovoltaic panels, many defects (such as tiny cracks or stains) may be compressed during the downsampling process, resulting in smaller feature maps. When using nn.Upsample for upsampling, although the interpolated feature maps restore the spatial resolution, they do not specifically handle small target defects during the simple interpolation process. The details of the defects (especially edge information) may not be fully restored during this process. This leads to blurred features of small targets, increasing the risk of missed detections, especially after multiple downsampling rounds, where the feature information of the target becomes more blurred, which is more obvious after upsampling by nn.Upsample. The calculation of traditional bilinear interpolation can be expressed as:  
\[I_{out}(x,y)=\sum_{i,j}w_{i,j}\times I_{in}\Big{(}x_{floor}+i,y_{floor}+j\Big{)} \tag{10}\]  
Among them, \(w_{i,j}\) is a fixed interpolation weight, only relying on the positional relationship between the target point and the surrounding four pixels cannot learn the detailed features of defects. This leads to the blurring of the edges of minor cracks or stains. Compared to nn.Upsample, as shown in Figure 5, EUCB [32] provides a more refined feature map enhancement method, particularly suitable for addressing the aforementioned issues. It enhances the upsampled feature maps through deep convolution, enabling the retention of the details of small targets beyond simple interpolation. This enhancement effectively avoids the loss of details after simple interpolation, thereby reducing missed detections. (1) Depthwise Separable Convolution  
Formula decomposition: Decompose the standard convolution into channel-wise convolution (Depthwise) and pointwise convolution (Pointwise):  
\[Depthwise:F_{dw}=\sum_{c}W_{dw}^{(c)}*X^{(c)} \tag{11}\]  
\[Pointwise:F_{out}=W_{pw}*F_{dw} \tag{12}\]\(W_{dw}\) is a single-channel convolution kernel; \(W_{pw}\) is a \(1\times 1\) convolution kernel. (2) Dynamic Upsampling (DySample)  
Generate offsets through dynamic convolution and adjust the sampling positions:  
\[\Delta\text{p}=\text{Conv}(F_{in}) \tag{13}\]  
The value of the target point \(p_{out}\) is:  
\[I_{out}(p_{out})=\sum_{k}w_{k}\times I_{in}(p_{out}+\Delta p_{k}) \tag{14}\]  
(3) Channel Adjustment and Feature Fusion  
\(1\times 1\) convolution reduces channel redundancy:  
\[F_{adjusted}=W_{1\times 1}*F_{upsampled} \tag{15}\]  
(4) Batch Normalization (BN)  
\[F_{norm}=\gamma\times\frac{F-\mu}{\sigma}+\beta \tag{16}\]  
To sum up, as mentioned above, EUCB uses deep convolution instead of standard convolution to process the upsampled feature maps, which helps extract richer details and more complex features, thereby avoiding the loss of important information during upsampling, especially for the details of small targets. Through batch normalization, the feature maps become more stable during training, reducing the problems of gradient disappearance or explosion during the training process and enabling the network to better learn useful features. The upsampled feature maps are usually larger in size and have an increased number of channels. EUCB reduces the number of channels through \(1\times 1\) convolution to maintain computational efficiency and reduce redundant features.