| PCB(Printed Circuit Board)is an important component of modern electronic products.Nowadays,PCB is widely used in communication,computer,household appliances,automotive,medical,military and other fields.With the development of highprecision and advanced technology,people have increasingly high requirements for the reliability of PCB.Therefore,improving the efficiency of PCB defect detection is of great significance.However,the current PCB defect detection methods have problems such as low accuracy in detecting small targets and slow detection speed,which cannot fully meet the requirements of actual PCB defect detection in industry.To solve this problem,a PCB defect detection solution based on deep learning is proposed.Initially,to address the problem of insufficient samples in the basic dataset,a new dataset is created and data diversity is enriched by using affine transformation,histogram feature enhancement,and noise transformation methods,in order to improve the generalization,robustness,and accuracy of the algorithm model.Next,through comparative experiments on PCB defect detection using different mainstream object detection algorithms,the performance indicators of YOLOv5 s algorithm were found to be the best for PCB defect detection.Additionally,to solve the problem of low accuracy in detecting small targets and slow detection speed in PCB defect detection,a YOLOv5s-4SKG algorithm based on improved YOLOv5 s is proposed.Firstly,a tiny detection layer is added to the output end of the YOLOv5 s algorithm to reduce the missing rate of small targets.Secondly,the K-means++algorithm is used to improve the extraction of cluster anchor box center points and select more suitable Anchor Box according to the dataset to improve the average detection accuracy.Thirdly,the GSConv is proposed to compensate for the shortcomings of the original convolution method,reduce network parameters and computational complexity,and improve the detection accuracy and speed.According to the ablation experiment results,the average detection accuracy mAP of the YOLOv5s-4SKG algorithm for recognizing PCB defects in the self-made PCB defect mixed dataset reached 96.3%,the detection speed FPS reached 43 frames,and the optimal weight size was 54.4MB.Compared with the YOLOv5 s algorithm,the mAP was increased by 3.1%,the detection was more accurate,the FPS was increased by 9 frames,the detection speed was faster,and the optimal weight model size was reduced by 3.5MB,making it easier to deploy.Overall,the better model performance indicators have been achieved.Finally,to facilitate user operation and practical application scenarios,a PCB defect detection system based on PyQt and YOLOv5s-4SKG algorithm model is designed.Tested,the system meets the requirements of real-time,accuracy,generalization,and robustness,and has certain value in improving the efficiency of PCB defect detection in actual scenarios. |