| With the continuous development of China’s digital transformation,Printed Circuit Board(PCB)plays an important role as a key component of electronic products in many fields such as aerospace,communication technology and automation technology.However,PCB in the production of welding process is prone to a variety of defects,in order to avoid PCB defects endanger the performance of the product,how to detect defects accurately and quickly positioning has an important research significance.For the traditional detection method in the defect detection process has high cost,low efficiency,accuracy and other problems,this paper gives an improved PCB defect detection method based on deep learning.The main research content is as follows:First,to address the problem of insufficient samples of PCB dataset in deep learning,which can easily lead to overfitting of the model,super-resolution generative adversarial network is used to expand the data of 693 original PCB images,and the expanded dataset contains 10688 PCB images,8640 images in the training set,961 images in the validation set,and 1067 images in the test set.Using the expanded dataset to train the YOLOv5(You Only Look Once)model,it solved the problem that the detection model could only identify one kind of defects missing holes in the original data,while the mean average precision of YOLOv5 for PCB defect detection was increased from 45.14% to 97.12%,and it could realize the classification and localization of six different defects.Secondly,in the built deep learning framework,by embedding four attention mechanism modules,CBAM,SE,ECA and CA-Block,between the three effective feature extraction networks 20×20×512,40×40×256 and 80×80×128 of the backbone feature extraction network of YOLOv5 model to the enhanced feature extraction network FPN,respectively,the YOLOv5 The experimental data show that the mean average precision of YOLOv5 with the introduction of ECA attention mechanism is 96.23%,which is higher than that of the previous algorithm by51.09%;the mean average precision of YOLOv5 with the introduction of CBAM attention mechanism is 95.60%,which is higher than that of the previous algorithm by 50.46%;the mean average precision of YOLOv5 with the introduction of CA attention mechanism is 96.23%,which is higher than that of the previous algorithm by 50.46%.The mean average precision of YOLOv5 with the introduction of the CA attention mechanism is 97.92%,which is higher than that of the previous algorithm by 52.78%;the average accuracy of YOLOv5 with the introduction of the SE attention mechanism is 97.97%,which is higher than that of the previous algorithm by 52.83%.Finally,adding the SE attention mechanism to the YOLOv5 algorithm fused with superresolution generative adversarial network algorithm can effectively improve the detection performance,and the average accuracy of various defects detection reaches 97.99% on average,which is higher than that of the algorithm before improvement by 52.85%,and improves the mean average precision of the model for the detection of hard-to-detect defects and small target defects on average. |