A High-Accuracy PCB Defect Detection Algorithm Based on Improved YOLOv12
To address the common issues of high small object miss rates, frequent false positives, and poor real-time performance in PCB defect detection, this paper proposes a multi-scale fusion algorithm based on the YOLOv12 framework. This algorithm integrates the Global Attention Mechanism (GAM) into the redesigned A2C2f module to enhance feature response strength of complex objects in symmetric regions through global context modeling, replacing conventional convolutions with hybrid weighted downsampling (HWD) modules that preserve copper foil textures in PCB images via hierarchical weight allocation. A bidirectional feature pyramid network (BiFPN) is constructed to reduce bounding box regression errors for micro-defects by fusing shallow localization and deep semantic features, employing a parallel perception attention (PPA) detection head combining dense anchor distribution and context-aware mechanisms to accurately identify tiny defects in high-density areas, and optimizing bounding box regression using a normalized Wasserstein distance (NWD) loss function to enhance overall detection accuracy. The experimental results on the public PCB dataset with symmetrically transformed samples demonstrate 85.3% recall rate and 90.4% mAP@50, with AP values for subtle defects like short circuit and spurious copper reaching 96.2% and 90.8%, respectively. Compared to the YOLOv12n, it shows an 8.7% enhancement in recall, a 5.8% increase in mAP@50, and gains of 16.7% and 11.5% in AP for the short circuit and spurious copper categories. Moreover, with an FPS of 72.8, it outperforms YOLOv5s, YOLOv8s, and YOLOv11n by 12.5%, 22.8%, and 5.7%, respectively, in speed. The improved algorithm meets the requirements for high-precision and real-time detection of multi-category PCB defects and provides an efficient solution for automated PCB quality inspection scenarios.
Authors
- Bingxiang Liu
- Zhi Chen
Institutions
- Jingdezhen Ceramic Institute (CN)
Publication Details
- Journal
- Symmetry
- Published
- 2025-06-20
- DOI
- https://doi.org/10.3390/sym17070978
- Citations
- 6
- Primary Topic
- Industrial Vision Systems and Defect Detection
- Type
- article
- Field-Weighted Citation Impact
- 7.45