Abstract
An enhanced clustering technique integrated with the YOLOv5s model addresses the challenges of detecting small defect targets on Printed Circuit Boards (PCBs), which are often difficult to locate and prone to high false detection rates. Initially, the method improves the original K-means algorithm by employing a self-developed Hierarchical Density-Based K-means (HDBK-means) algorithm to re-cluster and generate anchor boxes better suited to PCB fault characteristics. Secondly, it replaces the Concentrated-Comprehensive Convolution (C3) module with a novel combination of the Reparameterized Normalized Cross-Stage Partial Efficient Layer Aggregation Network (RepNCSPELAN) module and Spatial and Channel Reconstruction Convolution (SCConv), reducing the model's computational cost without compromising accuracy. Furthermore, the network is enhanced with an adaptive feature selection module to boost its performance in recognizing small targets. Lastly, the GDFPN (Generalized Dynamic Feature Pyramid Network) is used to achieve information interaction across different scales. further enhancing the network's detection accuracy. Comparative studies were conducted on a public PCB dataset. The experimental results demonstrate that the proposed algorithm achieves a mAP (mean Average Precision) of 98.6%, an accuracy of 99.2%, a model size of 10.9M, and an FPS (Frames Per Second) of 138.1. Compared to the original model, the proposed algorithm improves the mAP by 3.8% and the Precision (P) by 2.9%, while reducing the model size by 20.4%, thus fulfilling the requirements for easy deployment.