| Printed Circuit Board(PCB)has made great progress in technological innovation and research in recent years.Now it has become an important pillar of China’s economic transformation.PCB Products are being fabricated in a more compact and refined way to meet increasing market demand.However,the traditional PCB defect detection technology is accompanied by problems such as low detection efficiency,high missed detection rate,and high detection cost,which no longer meet the increasing quality requirements of PCB manufacturers.Therefore,the speed and accuracy of PCB defect detection need to be improved urgently.This thesis aims to solve the problems of low detection accuracy and low efficiency of traditional PCB defect detection algorithms by studying the PCB surface defect detection technology based on deep learning.The main work of the thesis is summarized as follows.I.Object detection algorithm research and data set constructionThis thesis starts with the basic structure of traditional convolutional neural networks and conducts an analogy between anchor-based one-stage and two-stage object detection algorithms and anchor-free object detection algorithms.The initial data set was selected on the IPC-A-600 standard,six types of PCB defects such as holes,mouse bites,open circuits,short circuits,residual copper,burrs,etc.were included in the data set,and then the initial data set was expanded from the original number of 693 samples to 12,890 using a variety of data enhancement techniques and the expanded dataset is visualized and analyzed in terms of object class distribution,centroid location distribution,and object size distribution.II.The establishment of PCB defect detection model based on TBA-YOLOThe anchor-based one-stage object detection algorithm YOLOv5s was used as the basis network,firstly,the encoder in the Transformer is used to replace the Bottleneck module in the C3 module,so that in the feature extraction process,the feature information of the large neighborhood around the PCB defect and the associated scene information is used to help the model learn the relationship between the objects.Centering and scaling calibrations were then applied at the beginning and end of the batch normalization process layer to enhance the model’s feature representation and obtain a more stable feature distribution.Finally,the improved bounding box loss function to obtain a more accurate bounding box regression.The experimental results show that the mean average precision of the TBA-YOLO model is 99.12%,which is 2.82%higher than before,and the improved model detection speed reaches 43 frames per second.Compared to the rest of the mainstream anchor-based object detection algorithms Faster R-CNN,SSD,YOLOV3,and YOLOv4 in the mean average precision TBA-YOLO was 4.71%,25.75%,16.42%,and 6.8%higher respectively.III.The establishment of an anchor-free PCB defect detection model based on feature fusionUsing the anchor-free object detection algorithm CenterNet as the baseline network,the feature extraction network of the original algorithm is replaced by the lightweight MobileNet,significantly reducing the number of model parameters.Then a new feature fusion module is designed by using multiple 1×1 convolutional layers and 3×3 convolutional layers for channel adjustment and combined with the CBAM attention mechanism.The shallow feature information of the model is then fused with the deep semantic information employing a feature pyramid structure.Finally,the coordinate attention mechanism is nested in the detection head to form the CA-Head,which allows the model to focus more on PCB defect location information during the classification and prediction process.The experimental results showed that the best performance metrics were achieved by using MobileNetv2 as the backbone feature extraction network.By incorporating the later model modification strategy,the mean average precision of the modified CenterNet model was 98.21%,which was 2.23%higher than before,while the detection speed reached 55 frames per second,which was 30 frames per second faster than before,the improved CenterNet model has a weight reduction of 99.7 MB and the anchor-frame object detection algorithm model outperforms on a variety of evaluation metrics.IV.The construction of a PCB defect detection systemIn order to make the evaluation and detection of models more intuitive and easy to use,this thesis builds a deep learning-based PCB defect detection system.The front-end interface design was first completed by using PyQt5.The server-side design is done in Python and the algorithmic model processing is done using the open-source framework Pytorch and OpenCV.The functions implemented in the system include system login/registration and the main interface,where the user can directly select the model weight file as well as the detection streams such as pictures,folders,videos,and cameras,the main interface also has a start/pause and memory path setting function.Finally,the two PCB defect detection models proposed in this thesis are tested on the system.and the advantages and disadvantages of the two models are analyzed comprehensively.In summary,this thesis investigates the deep learning based PCB defect detection technique,where the defects present on the PCB image are classified and localized with a target detection algorithm.Firstly,the TBA-YOLO PCB defect detection model is proposed to achieve accurate identification of various PCB defects in the dataset.Later,to address the problems of the reliance of the default anchor-box settings of anchor-based object detection algorithm,the existence of too many hyperparameters,and the imbalance of positive and negative samples,the anchor-free object detection algorithm CenterNet is used as the basic network to propose a PCB defect detection model based on feature fusion without anchor box.The experimental results show that both models can meet the accuracy requirements of PCB defect detection. |