Abstract:Facing the trend of miniaturization, multilayer,and high integration of print circuit board (PCB),to address the problems of missed detection,difficult feature extraction,high false detection rate,and poor detection performance of current PCB defect detection methods,this paper proposes a PCB small target defect detection method based on the improved YOLOv5 algorithm.It first uses the density-based spatial clustering of applications with noise (DBSCAN)+dichotomous K-means clustering algorithm for PCB small target defect characteristics to find a more suitable anchor frame.It then improves the feature extraction layer,feature fusion layer,and feature detection layer of the YOLOv5 network to enhance the extraction of key information and strengthen the fusion of deep and shallow information.This reduces the false and missed detection rate of PCB defects to improve the detection performance of the network.Finally,relevant comparative experiments are conducted on the publicly available PCB dataset.The results show that the improved model has an average accuracy () of 99.5% and a detection speed of 0.016 s.Compared with the Faster R-CNN, YOLOv3,and YOLOv4 network models,the detection accuracy is improved by 17.8%,9.7% and 5.3%,respectively,and the detection speed is improved by 0.846 s,0.120 s and 0.011 s,respectively,which satisfies the requirements of high precision and high-speed detection of PCB defects in actual industrial production sites.