PCB Defect Based on Improved YOLOv7: History
Please note this is an old version of this entry, which may differ significantly from the current revision.
Contributor: ,

The printed circuit board (PCB) holds immense importance in the electronic industry as a crucial component for the development of electronic products. PCBs are becoming increasingly integrated and smaller due to the excellent craftsmanship, precise wiring, and rapid development of integrated circuits.

  • deep learning
  • printed circuit boards
  • YOLOv7

1. Introduction

The printed circuit board (PCB) holds immense importance in the electronic industry as a crucial component for the development of electronic products. PCBs are becoming increasingly integrated and smaller [1] due to the excellent craftsmanship, precise wiring, and rapid development of integrated circuits. However, with the reduction in size, defects in the PCBs are also getting smaller and more challenging to detect. Therefore, it is imperative to conduct a thorough defect detection process during PCB-related production to improve product quality and reduce company costs.
The conventional methods of detecting defects in PCBs are classified into three categories: manual visual inspection, electrical testing, and optical inspection [2]. Manual visual inspection involves workers inspecting bare PCBs directly using their eyes and other equipment. However, this method has become inadequate due to the increasing demand for higher precision in PCB development, as it has poor detection stability and low efficiency. On the other hand, electrical testing employs contact testing to detect defects in bare PCBs, which requires complex testing circuits, expensive molds, and fixtures for each batch of PCBs. This method is also limited in detecting multi-layer PCBs and poses a risk of secondary damage. In contrast, automated optical inspection (AOI) is a non-contact inspection method that uses machine vision technology and image processing algorithms [3]. Industrial cameras capture images of the PCBs, which are transmitted to a computer that provides feedback on the defect detection results. AOI is more stable and accurate than the previous methods, with a faster detection speed [4], and does not impact the PCB.
The advancement of deep learning has led to the development of contactless automatic detection methods, which have become a popular area of research due to their strong recognition adaptability and generalization ability. Typically, deep learning-based detection networks can be categorized into one-stage and two-stage networks. The one-stage network includes Single Shot Detector (SSD) [5], and You Only Look Once (YOLO) [6]. In contrast, the two-stage network includes regions with convolutional neural networks (R-CNN) [7], Fast R-CNN [8], and Faster R-CNN [9], which is an improved version of R-CNN. The primary difference between these networks is that the one-stage network directly predicts the location and category of defects in the network after feature extraction, while the two-stage network first generates proposals that may include defects, then conducts the detection process. Specifically, the two-stage network generates candidate boxes of different sizes that may contain defect features, then performs target detection to predict defect classes and locations. However, the detection speed is slow due to the generation of many candidate frames. On the other hand, the one-stage network performs both training and detection in a single network without the need for explicit region proposals, resulting in faster detection speed. This paper adopts the one-stage network based on YOLOv7 [10] and improves it to meet real-time performance requirements in the industrial field.
The Swin Transformer v2 [11] is designed to overcome three significant challenges in large visual model training and application, namely, model instability, the resolution gap problem, and a chronic lack of labeled data. To address these challenges, the Swin Transformer v2 proposes three primary methods. First, it combines cosine attention and post-normalization to enhance model stability. Second, it introduces a logarithmic space continuous location deviation method, which enables the model to be trained on low-resolution images, then transferred to its higher-resolution counterparts. Lastly, it introduces SimMIM, a self-supervised pretraining method that reduces the need for large amounts of labeled data. To improve the global feature extraction and stability of the model, SwinV2_CSPB modules can replace some ELAN modules in the YOLOv7 backbone network.

2. PCB Defect Based on Improved YOLOv7

The conventional approach for detecting visual anomalies in artificial systems has drawbacks, such as high cost, low efficiency, and errors in detection. As an alternative, the electrical properties of components can be leveraged for detecting defects in printed circuit boards (PCBs) through a semi-automatic, manual detection method that includes online and functional testing [12]. Researchers have explored various techniques to enhance this method, such as compressing images using wavelet transform to reduce memory and computation requirements [13], using traditional machine learning algorithms for defect detection [14], and designing low-complexity neural network and machine vision schemes to improve defect detection [15]. Other approaches include using Fourier image reconstruction to identify small defects [16] and ultrasonic laser thermal imaging for real-time defect detection [17]. Although these methods can reduce costs compared to manual detection, their limited application is attributed to factors, such as the non-reusability of the test process, the high cost of equipment, and complex writing functions, among others.
Machine vision detection methods have emerged as a viable solution to overcome the shortcomings of traditional artificial detection methods and are increasingly being applied in modern industries [18]. There are three primary categories of PCB defect detection methods based on machine vision: reference, non-reference, and hybrid methods. The reference method [19] typically involves image segmentation techniques to detect defects. For example, Li et al. compared PCB images with and without defects to identify defects [20]. Non-reference methods [21] mainly rely on machine learning algorithms for defect detection. For instance, Malge et al. employed an image segmentation algorithm to detect PCB defects [22]. The hybrid method [23] combines reference and non-reference methods to achieve more accurate defect detection. For example, Ray et al. developed a hybrid detection method by comparing PCB images and using image segmentation techniques [24]. Image segmentation techniques include threshold segmentation, edge segmentation, and region segmentation methods. For example, Ardhy et al. [25] used the adaptive Gaussian threshold segmentation to achieve rapid detection with minimal parameters, but the detection efficacy varied significantly in different areas with light strips. Baygin et al. [26] used Hough transform for edge segmentation and combined it with the Canny operator to enhance detection efficiency. Ma et al. [27] improved the region growth algorithm for region segmentation to achieve better detection outcomes. However, these methods require manual tuning of model parameters, which may lead to suboptimal accuracy and efficiency.
Recent studies have demonstrated that the accuracy of automated optical inspection (AOI) is higher compared to other methods. However, due to the system’s high sensitivity, it has very strict parameter-setting rules and may miss some cases, necessitating manual screening after machine screening is complete [28]. Meanwhile, deep learning technology has been rapidly advancing. Target defect detection methods based on deep learning have shown to be highly accurate, fast, and do not require manual screening. Thus, they are more cost-effective and efficient. Moreover, the parameter-setting rules are not as strict as those in the AOI system. As a result, deep learning-based methods are being increasingly studied and applied in various industries.
Due to advancements in computing technology, complex operations have become more affordable, resulting in the rapid development of neural networks, including a large number of deep neural networks. In the field of PCB defect detection, many scholars have applied deep learning techniques. DenseNet [29] achieved better performance with fewer parameters and computing costs by densely connecting all front and back layers to enable feature reuse. Huang et al. [30] improved detection accuracy and efficiency by designing a convolutional neural network that connects each layer in a feedforward manner. Compared to conventional machine vision methods, deep learning algorithms have stronger nonlinear abilities, higher robustness, and are applicable to more complex scenarios. He [31] proposed an improvement measure that helped achieve a 96.91% accuracy rate. Geng et al. [32] improved the detection accuracy to 96.65% by using focal loss and ResNet50 as the backbone network. Ding et al. [33] designed TDD-net, a detection network specifically aimed at tiny PCB defects, which adopted a multi-scale fusion strategy and applied online hard example mining to enhance the certainty of ROI proposals, resulting in a detection accuracy of 98.90%. Sun et al. [34] proposed the Inception-ResNet-v2 model, which improved the PCB detection accuracy by adding an SE module to part of the structure. Hu et al. [35] presented UF-Net, which retained more defect target information by using the Skip Connect method and achieved a detection accuracy of 98.6%. Li et al. [36] improved the mAP value to 98.71% by replacing the convolution layer in the trunk with the residual structure unit CSP based on the YOLOv4 algorithm. Wang et al. [37] proposed a lightweight model that used the ShuffleNetV2 structure in the YOLOv5 backbone and achieved an accuracy of 95%. YOLOv7, as a classic representative of the target detection algorithm, has surpassed the previous YOLO series in detection speed and accuracy.

This entry is adapted from the peer-reviewed paper 10.3390/electronics12092120

References

  1. Zheng, L.J.; Zhang, X.; Wang, C.Y.; Wang, L.F.; Li, S.; Song, Y.X.; Zhang, L.Q. Experimental study of micro-holes position accuracy on drilling flexible printed circuit board. In Proceedings of the 11th Global Conference on Sustainable Manufacturing, Berlin, Germany, 23–25 September 2013.
  2. Deng, L. Research on PCB Surface Assembly Defect Detection Method Based on Machine Vision. Master’s Thesis, Wuhan University of Technology, Wuhan, China, 2019.
  3. Zhu, Y.; Ling, Z.G.; Zhang, Y.Q. Research progress and prospect of machine vision technology. J. Graph. 2020, 41, 871–890.
  4. Khalid, N.K.; Ibrahim, Z.; Abidin, M.S.Z. An Algorithm to Group Defects on Printed Circuit Board for Automated Visual Inspection. Int. J. Simul. Syst. Sci. Technol. 2008, 9, 1–10.
  5. Liu, W.; Anguelov, D.; Erhan, D.; Szegedy, C.; Reed, S.; Fu, C.-Y.; Berg, A.C. SSD: Single shot multibox detector. In Proceedings of the Computer Vision–ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, 11–14 October 2016; Part I 14; Springer International Publishing: Berlin/Heidelberg, Germany, 2016; pp. 21–37.
  6. Redmon, J.; Divvala, S.; Girshick, R.; Farhadi, A. You only look once: Unified, real-time object detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 779–788.
  7. Girshick, R.; Donahue, J.; Darrell, T.; Malik, J. Rich feature hierarchies for accurate object detection and semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Columbus, OH, USA, 23–28 June 2014; pp. 580–587.
  8. Girshick, R. Fast r-cnn. In Proceedings of the IEEE International Conference on Computer Vision, Santiago, Chile, 13–16 December 2015; pp. 1440–1448.
  9. Ren, S.; He, K.; Girshick, R.; Sun, J. Faster R-CNN: Towards real-time object detection with region proposal networks. Adv. Neural Inf. Process. Syst. 2015, 28.
  10. Wang, C.Y.; Bochkovskiy, A.; Liao, H.Y.M. YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors. arXiv 2022, arXiv:2207.02696.
  11. Liu, Z.; Hu, H.; Lin, Y.; Yao, Z.; Xie, Z.; Wei, Y.; Ning, J.; Cao, Y.; Zhang, Z.; Dong, L.; et al. Swin transformer v2: Scaling up capacity and resolution. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, New Orleans, LA, USA, 18–24 June 2022; pp. 12009–12019.
  12. Liu, Z.; Qu, B. Machine vision based online detection of PCB defect. Microprocess. Microsyst. 2021, 82, 103807.
  13. Kim, J.; Ko, J.; Choi, H.; Kim, H. Printed circuit board defect detection using deep learning via a skip-connected convolutional autoencoder. Sensors 2021, 21, 4968.
  14. Gaidhane, V.H.; Hote, Y.V.; Singh, V. An efficient similarity measure approach for PCB surface defect detection. Pattern Anal. Appl. 2018, 21, 277–289.
  15. Annaby, M.H.; Fouda, Y.M.; Rushdi, M.A. Improved normalized cross-correlation for defect detection in printed-circuit boards. IEEE Trans. Semicond. Manuf. 2019, 32, 199–211.
  16. Tsai, D.M.; Huang, C.K. Defect detection in electronic surfaces using template-based Fourier image reconstruction. IEEE Trans. Compon. Packag. Manuf. Technol. 2018, 9, 163–172.
  17. Cho, J.W.; Seo, Y.C.; Jung, S.H.; Jung, H.K.; Kim, S.H. A study on real-time defect detection using ultrasound excited thermography. J. Korean Soc. Nondestruct. Test. 2006, 26, 211–219.
  18. Dong, J.Y.; Lu, W.T.; Bao, X.M.; Luo, S.Y.; Wang, C.Q.; Xu, W.Q. Research progress of the PCB surface defect detection method based on machine vision. J. Zhejiang Sci.-Tech. Univ. (Nat. Sci. Ed.) 2021, 45, 379–389.
  19. Chen, S. Analysis of PCB defect detection technology based on image processing and its importance. Digit. Technol. Appl. 2016, 10, 64–65.
  20. Li, Z.M.; Li, H.; Sun, J. Detection of PCB Based on Digital Image Processing. Instrum. Tech. Sens. 2012, 8, 87–89.
  21. Liu, B.F.; Li, H.W.; Zhang, S.Y.; Lin, D.X. Automatic Defect Inspection of PCB Bare Board Based on Machine Vision. Ind. Control. Comput. 2014, 27, 7–8.
  22. Malge, P.S.; Nadaf, R.S. PCB defect detection, classification and localization using mathematical morphology and image processing tools. Int. J. Comput. Appl. 2014, 87, 40–45.
  23. Moganti, M.; Ercal, F. Automatic PCB inspection systems. IEEE Potentials 1995, 14, 6–10.
  24. Ray, S.; Mukherjee, J. A Hybrid Approach for Detection and Classification of the Defects on Printed Circuit Board. Int. J. Comput. Appl. 2015, 121, 42–48.
  25. Ardhy, F.; Hariadi, F.I. Development of SBC based machine-vision system for PCB board assembly automatic optical inspection. In Proceedings of the 2016 International Symposium on Electronics and Smart Devices (ISESD), Bandung, Indonesia, 29–30 November 2016; pp. 386–393.
  26. Baygin, M.; Karakose, M.; Sarimaden, A.; Akin, E. Machine vision-based defect detection approach using image processing. In Proceedings of the 2017 International Artificial Intelligence and Data Processing Symposium (IDAP), Malatya, Turkey, 16–17 September 2017; pp. 1–5.
  27. Ma, J. Defect detection and recognition of bare PCB based on computer vision. In Proceedings of the 2017 36th Chinese Control Conference (CCC), Dalian, China, 26–28 July 2017; pp. 11023–11028.
  28. Deng, Y.S.; Luo, A.C.; Dai, M.J. Building an automatic defect verification system using deep neural network for pcb defect classification. In Proceedings of the 2018 4th International Conference on Frontiers of Signal Processing (ICFSP), Poitiers, France, 24–27 September 2018; pp. 145–149.
  29. Huang, G.; Liu, Z.; Van Der Maaten, L.; Weinberger, K.Q. Densely connected convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 4700–4708.
  30. Huang, W.; Wei, P. A PCB dataset for defects detection and classification. arXiv 2019, arXiv:1901.08204.
  31. He, X.Z. Research on Image Detection of Solder Joint Defects Based on Deep Learning. Master’s Thesis, Southwest University of Science and Technology, Mianyang, China, 2021; pp. 30–38.
  32. Geng, Z.; Gong, T. PCB surface defect detection based on improved Faster R-CNN. Mod. Comput. 2021, 19, 89–93.
  33. Ding, R.; Dai, L.; Li, G.; Liu, H. TDD-net: A tiny defect detection network for printed circuit boards. CAAI Trans. Intell. Technol. 2019, 4, 110–116.
  34. Sun, C.; Deng, X.Y.; Li, Y.; Zhu, J.R. PCB defect detection based on improved Inception-ResNet-v2. Inf. Technol. 2020, 44, 4.
  35. Hu, S.S.; Xiao, Y.; Wang, B.S.; Yin, J.Y. Research on PCB defect detection based on deep learning. Electr. Meas. Instrum. 2021, 58, 139–145.
  36. Li, C.F.; Cai, J.L.; Qiu, S.H.; Liang, H.J. Defect detection of PCB based on improved YOLOv4 algorithm. Electron. Meas. Technol. 2021, 44, 146–153.
  37. Wang, S.Q.; Lu, H.; Lu, D.; Liu, Y.; Yao, R. PCB Board Defect Detection Based on Lightweight Artificial Neural Network. Instrum. Tech. Sens. 2022, 5, 98–104.
More
This entry is offline, you can click here to edit this entry!