YOLO-SAM: An Asymmetric Lightweight Detector with Space-to-Depth Convolution for PCB Defect Detection
Zhiyan Zhong, Bei Zhang, Hongxin WangPrinted circuit board (PCB) defect detection remains challenging because micro-scale defects often exhibit weak contrast and are easily suppressed by conventional downsampling and balanced multi-scale detection heads. To address these limitations, this paper proposes YOLO-SAM, a lightweight YOLOv8n-based detector with an asymmetric prediction topology for industrial visual inspection. YOLO-SAM integrates an Efficient Channel Attention (ECA)-based C2f_Attention block to enhance defect-aware feature responses, replaces strided downsampling with space-to-depth convolution (SPD-Conv) to preserve fine-grained spatial information, and introduces a high-resolution 160×160 prediction branch while pruning the coarse 20×20 head. MPDIoU loss is further adopted to improve corner-aware bounding box regression. Experiments on the PKU PCB benchmark show that YOLO-SAM achieves 94.68% mAP@0.5 and 92.42% F1-Score with only 1.50 M parameters, improving mAP@0.5 over YOLOv8n by 5.50 percentage points while reducing the parameter count by approximately 50%. Additional evaluations on the DeepPCB and magnetic tile datasets achieve 99.22% and 98.20% mAP@0.5, respectively, indicating that the proposed asymmetric lightweight architecture is effective for heterogeneous industrial defect inspection tasks.