Automated Optical Inspection (AOI) plays a critical role in modern printed circuit board (PCB) manufacturing. However, conventional deep learning frameworks often struggle with high false-positive rates and substantial computational overhead, limiting their viability for seamless deployment on resource-constrained edge hardware. In this paper, we propose a lightweight, fast, and efficient YOLOv8-based model for PCB defect detection. The core objective is to achieve a practical compromise between processing throughput and detection accuracy in real-time production lines.
To enhance spatial adaptability and capture intricate structural variations in defects without bloating the model size, we integrate an enhanced deformable convolutional module from DCNv4 into the backbone network. This deformable convolutional module helps adjust the receptive field dynamically, which allows the model to effectively adapt to irregular defect geometries. Furthermore, to reduce memory traffic and computational complexity, a Cross Stage Partial with Partial Convolution (CSPPC) module is introduced into the neck architecture for parameter reduction. This structural refinement significantly reduces redundant feature computations while maintaining a streamlined data flow during inference.
We evaluate our proposed model on an open-source PKU-Market-PCB dataset. Experimental results demonstrate that our architecture successfully reduces the parameter count by 12.6% (from 3.01M to 2.63M) and lowers computational complexity by 7.4% (from 8.1 GFLOPs to 7.5 GFLOPs) compared to YOLOv8. Crucially, the model overcomes lightweight design trade-offs by simultaneously improving speed and accuracy. Specifically, it achieves a 2.2% relative improvement in precision (from 92.9% to 94.9%), a 1.4% relative gain in recall (from 80.1% to 81.2%), a 0.9% relative increase in mAP50 (from 87.4% to 88.2%), and a 3.7% increase in inference speed (from 137 FPS to 142 FPS). Our proposed model outperforms standard baselines in both deployment efficiency and reliability, as seen in RT-DETR. These results validate our model as a highly balanced, viable solution for edge-based industrial inspection systems.