# EER-DETR: An Improved Method for Detecting Defects on the Surface of Solar Panels Based on RT-DETR
## 3 Algorithm  
### Rat-Detr  
RT-DETR (Real-Time Detection Transformer) is a new generation of the end-to-end real-time object detection model proposed by the Baidu Research Institute in 2023 [25]. Its core innovation lies in deeply integrating the high-precision characteristics of the Transformer architecture with real-time inference requirements, breaking through the limitations of traditional detection models that rely on anchor box design and non-maximum suppression (NMS). This model was first publicly disclosed in relevant papers of top-tier computer vision conferences, and its architecture design closely revolves around the real-time performance, robustness of accuracy, and hardware adaptability for industrial deployment, becoming the first pure Transformer detection framework to achieve 100+ FPS on a general-purpose GPU platform.  
As illustrated in Figure 1, the architecture of RT-DETR is methodically divided into three main parts, the backbone, the hybrid encoder, and the decoder: (1) the multi-scale feature extraction backbone network supports flexible replacement, and the default configuration includes ResNet series, lightweight HGNetv2, etc., generating C3-C5 multi-level feature maps through deep convolutional networks; (2) the Hybrid Encoder innovatively integrates the local feature induction bias of CNN and the global modeling ability of the Transformer, serializing multi-level feature maps through cross-scale feature interaction modules (such as ASFF or FPN variants) into high-semantic-density embedding vectors,and introducing an IoU-aware query selection mechanism to dynamically generate initial target queries in the encoding stage, significantly improving the convergence efficiency of the decoder; (3) the dynamic configurable decoder adopts a hierarchical cascading structure, achieving a runtime adjustment in the decoding depth through pluggable attention layers (such as X version with six layers and L version with three layers), combined with auxiliary prediction heads for intermediate supervision, enabling the model to maintain 98% detection accuracy while reducing 33% of the computational load. Particularly, this decoder abandons the traditional fixed-length query design of the DETR series and instead adopts an adaptive query generation strategy based on the spatial position of feature maps, achieving an AP50 metric of 73.1% on the COCO dataset.  
Compared with traditional detection models, RT-DETR has significant advantages in three aspects: firstly, its fully end-to-end characteristic eliminates the post-processing step of NMS, reducing the inference delay fluctuation to less than 5% in dense object scenarios (such as crowd detection), improving stability by 3-times compared to YOLOv8; secondly, the dynamic inference mechanism allows for the trade-off between accuracy and speed by adjusting the number of decoder layers (1-6 layers) within a single model, achieving a maximum speed of 114 FPS on a T4 GPU with the HGNetv2 backbone, while the accuracy only drops by 0.8 AP; thirdly, the cross-modal compatibility is achieved through decoupled feature encoding design, seamlessly integrating multimodal data inputs such as point clouds and infrared, reducing the false detection rate by 42% compared to CenterNet in Baidu's autonomous driving real-world tests. Experimental verification shows that this model maintains a detection recall rate of 91% in extreme scenarios (such as rainy and foggy weather, motion blur), and its lightweight version RT-DETR-tiny achieves real-time inference at 28 FPS on the Jetson Nano edge device, with power consumption lower than 5 W.