## 4 Deep Learning-Based Defect Detection AI Engine  
In the semiconductor manufacturing process, Printed Circuit Boards (PCBs) are one of the key components. Due to the complexity of the manufacturing process, defects such as lifted solder, open circuits, missing components, and short circuits can occur in soldered areas, leading to performance degradation [28]. PCB defect detection technology has recently made significant advancements, transitioning from vision-based inspection to AI-based inspection using deep learning. Real-time inspection algorithms researched until recently include CNN-based single-stage algorithms, such as the YOLO series, which have shown excellent performance in real-time object detection over the years [28; 29; 30; 31]. The YOLO series has been studied with both anchor-based techniques and anchor-free methods, but it has shown speed reduction issues due to the Non-Maximum Suppression (NMS) post-processing required to eliminate numerous overlapping bounding boxes. Figure 6: Image data preprocessing method in defect inspection using line-scan camera. Since PCB defect detection requires high speed and accuracy, DETR, an End-to-End Transformer-based object detection method that removes NMS, has been proposed. This method eliminates manually created anchors and directly predicts one-to-one object sets using bipartite matching instead of NMS. Despite these advantages, DETR faces challenges such as slow training convergence, high computational costs, and optimization difficulties with complex queries. Research on various transformer methods, such as Deformable-DETR, DAB-DETR, DN-DETR, and Group-DETR, has been conducted; however, they still have high computational costs and are not adequately designed for real-time detection [28]. In contrast, the RT-DETR (Real-Time Detection Transformer) method optimizes query initialization and reduces computational costs, demonstrating high performance suitable for real-time detection. As shown in Figure 7, the last three stages of the backbone {S3, S4, S5} were used as inputs to the encoder. An efficient hybrid encoder converts multiscale features into a sequence of image features through intra-scale feature interactions and cross-scale feature fusion. Subsequently, query selection with minimal uncertainty was used to select a fixed number of encoders to be used as the initial object queries for the decoder. Finally, the decoder, which is equipped with auxiliary prediction heads, iteratively optimizes the object queries to generate classifications and bounding boxes. Non-Maximum Suppression (NMS) is a post-processing algorithm widely used in object detection to eliminate unnecessary bounding boxes when detected boxes overlap. NMS requires two hyperparameters: an intersection over union (IoU) threshold and a confidence threshold. The algorithm selects the box with the highest confidence among overlapping boxes and removes the remaining boxes. This process is repeated until all boxes across all categories have been processed, so the time required for NMS depends on the number of bounding boxes and the hyperparameters. RT-DETR consists of a backbone, an efficient hybrid encoder, and a transformer decoder with auxiliary prediction heads. The RT-DETR pipeline is shown in Figure 8. In Figure 8, SSE represents a single-scale transformer encoder, and MSE represents a multi-scale transformer encoder. The transformer encoder and CSF indicate cross-scale fusion. AIFI and CCFF are two modules designed as hybrid encoders. Figure 9 shows fusion block in CCFF. The encoder consists of two modules: AIFI (Attention-based Intracale Feature Interaction) and Cross-scale Feature Fusion. AIFI reduces the computational cost based on variant D. CCFF (Cross-scale Fusion module) adds multiple fusion blocks composed of convolutional layers to the fusion path. The role of the fusion block is to fuse two adjacent scale features into a new feature. Reshape is an operation to restore the shape of the flattened feature such as \(S_{5}\). Figure 7: RT-DETR Model overview.