Abstract:
Printed circuit board (PCB) defect detection serves as an essential quality control procedure in the modern electronic manufacturing chain. Its detection precision and real-time inference speed directly influence the final product reliability, production yield, and overall production efficiency of industrial automated assembly lines. Defective regions occupy an extremely small proportion of image pixels and share texture features that are highly similar to dense and complex circuit traces, metal pads, and conductive vias, which pose severe obstacles to most existing detection algorithms and increase the risk of false detections. Current mainstream deep learning detection methods have evident limitations in three key technical aspects: insufficient fine-grained feature characterization for tiny defective targets, limited capacity to suppress complex background interference generated by intertwined and dense wiring, and unsatisfactory localization accuracy for irregular and micro-defects. To address these critical challenges in industrial inspection, this study constructs a cross-scale feature fusion and state-space collaborative modeling detection model (CFSC–DETR) based on the classic real-time detection transformer (RT-DETR) architecture. In the feature extraction backbone network, ResNet18, a lightweight DualConv module is introduced to eliminate redundant convolutional operations and reduce the computational overhead while significantly boosting the capability of the network to capture the fine local textures and edge information associated with tiny micro-PCB defects. During the encoder feature modeling phase, a detail-aware attentive state-space reasoning module(DASM) is proposed for global context learning. By integrating a local window attention mechanism with linear-complexity state-space modeling, this module enhances the ability of the model to capture the integral topological structure of complete PCB boards and long-range contextual information across discrete image regions, thereby effectively reducing the disturbance from irrelevant and visually similar background circuit textures. For multiscale feature aggregation and fusion, a 3D adaptive feature fusion neck network (L3D–AFFN) is specially constructed for small-object detection tasks. This structural design effectively prevents the severe loss of fine-grained semantic information associated with tiny defects during cross-scale feature fusion and preserves the complete defect feature information across all multiscale feature layers. Moreover, a novel Wasserstein–geometric synergistic intersection over union loss function (WGS–IoU) is proposed for regression optimization. This loss function jointly imposes dual complementary constraints including the distribution similarity, measured by the Wasserstein distance, and the geometric consistency of bounding boxes, which stabilizes gradient propagation during model training and remarkably enhances the bounding box regression precision for both ultra-small defects and abnormally shaped irregular defects on PCBs. Extensive ablation and comparative experiments are conducted on the open PKU-Market-PCB public dataset. The experimental results indicate that, compared with the original RT-DETR baseline model, the proposed CFSC–DETR improves mAP50, precision, and recall by 3.29, 4.06, and 4.71 percentage points, respectively. Meanwhile, the total parameter size of the optimized lightweight model is reduced to 15.23 MB, and the real-time inference speed of 97.64 FPS is achieved on a single GPU, balancing the high detection accuracy with low computational cost. Additional cross-domain generalization tests on DsPCBSD+ and DeepPCB datasets further validate the strong cross-scene generalization capacity of the proposed CFSC–DETR model. Comparative experiments with multiple state-of-the-art mainstream object detection algorithms further demonstrate that CFSC-DETR possesses superior performance when addressing the challenging task of tiny PCB defect detection under highly intricate and complex circuit backgrounds.