Next Article in Journal
Regulating Modality Utilization within Multimodal Fusion Networks
Previous Article in Journal
Optimization of the Pixel Design for Large Gamma Cameras Based on Silicon Photomultipliers
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

YOLO-BFRV: An Efficient Model for Detecting Printed Circuit Board Defects

College of Computer and Control Engineering, Northeast Forestry University, Harbin 150040, China
*
Author to whom correspondence should be addressed.
Sensors 2024, 24(18), 6055; https://doi.org/10.3390/s24186055
Submission received: 25 July 2024 / Revised: 21 August 2024 / Accepted: 11 September 2024 / Published: 19 September 2024
(This article belongs to the Topic Applications in Image Analysis and Pattern Recognition)

Abstract

:
The small area of a printed circuit board (PCB) results in densely distributed defects, leading to a lower detection accuracy, which subsequently impacts the safety and stability of the circuit board. This paper proposes a new YOLO-BFRV network model based on the improved YOLOv8 framework to identify PCB defects more efficiently and accurately. First, a bidirectional feature pyramid network (BIFPN) is introduced to expand the receptive field of each feature level and enrich the semantic information to improve the feature extraction capability. Second, the YOLOv8 backbone network is refined into a lightweight FasterNet network, reducing the computational load while improving the detection accuracy of minor defects. Subsequently, the high-speed re-parameterized detection head (RepHead) reduces inference complexity and boosts the detection speed without compromising accuracy. Finally, the VarifocalLoss is employed to enhance the detection accuracy for densely distributed PCB defects. The experimental results demonstrate that the improved model increases the mAP by 4.12% compared to the benchmark YOLOv8s model, boosts the detection speed by 45.89%, and reduces the GFLOPs by 82.53%, further confirming the superiority of the algorithm presented in this paper.

1. Introduction

Printed circuit boards (PCBs) are extensively used in the automotive and communications sectors as well as numerous other critical modern industrial sectors. During the PCB production process, which involves pressing, drilling, copper deposition, dry film application, and other processes [1], defects may be introduced at each stage. Consequently, PCB defect detection technology has become a critical quality control technology in the electronics manufacturing industry. As the world progresses towards digitization, PCB design and production increasingly focus on miniaturization, high precision, high density, and high reliability. Traditional methods, such as manual inspection [2], electrical detection [3], and automatic optical inspection [4], are becoming insufficient to meet the current requirements of PCB manufacturing. Image processing techniques, including threshold segmentation [5], edge detection [6] and region growth [7] methods, are constrained by challenges such as feature selection, lighting conditions, and noise interference. These methods often necessitate manual rules and feature definitions, leading to algorithms with relatively low robustness and generalization capabilities. This undoubtedly presents a formidable challenge to deep learning-based PCB defect detection.
The intricate manufacturing process of PCBs frequently generates various types of defects, including rat bites, spurs, and open circuits. Even minor imperfections can significantly impact PCB performance, posing substantial challenges for models to identify multiple defects with efficiency and accuracy simultaneously. In this regard, Xia et al. [8] proposed the SSIM-Net network, which employs a lightweight backbone network, MobileNet-V3, to classify defective regions, dramatically increasing the speed of PCB defect detection without losing accuracy. Liu and Wen [9] proposed a PCB defect detection model (MobileNet-YOLO-Fast) with a small model size and good real-time performance. Owing to the varying manufacturing processes, PCB surface defects typically measure less than 4500 pixels, with some, such as spurs, being smaller than 300 pixels. Consequently, detecting these small-scale defects swiftly and accurately becomes exceedingly challenging. Ding et al. [10] proposed TDD-Net, which uses the k-means++ clustering method to obtain more accurate anchor frames and efficiently detect minor target defects. In 2023, Lim et al. [11] addressed the difficulty of inferring small or changing defects on PCBs in real time by enhancing tiny defect detection through contextual information inclusion. Achieving high accuracy in defect detection models necessitates a substantial amount of data. However, when the available PCB product image data are insufficient, the model struggles to learn and distinguish the features of various defects effectively. Hua [12] designed a recursive residual network to aggregate the features extracted by this model to obtain the indicators reflecting the target features to improve detection accuracy. Park et al. [13] proposed the MarsNet detection network, which solves the problem of different scales of actual defect data and training data by improving the expanded residual network.
By addressing the aforementioned challenges while integrating the inherent physical characteristics of PCB defects, this paper proposes a PCB defect detection method that improves the YOLOv8 model. The main contributions of this study are summarized as follows:
(1)
The introduction of a BIFPN in the Neck addresses the problems of PANet in the original model regarding the fusion of diverse layer features. This enhancement significantly improves the model’s capacity to capture small target feature information, thereby enabling more efficient extraction of various defect features.
(2)
The FasterNet lightweight network is integrated into the Backbone, effectively utilizing the channel information across various PCB defect types. This integration preserves the diversity of defect features and enhances the computational efficiency all while improving detection accuracy.
(3)
The detection head has been reconstructed, incorporating a re-parameterized design that reduces the number of parameters while enhancing the detection capabilities for small target defects.
(4)
To address the challenge of detecting PCB defects in dense distributions, this paper employs VarifocalLoss as the loss function. This approach mitigates the difficulties associated with defect detection in such contexts and significantly enhances the model’s detection accuracy.
The remainder of this paper is organized as follows: Section 2 outlines the creation of the dataset and the improved model with four modules. Subsequently, Section 3 presents a thorough analysis of the experimental results. Finally, Section 4 offers a summary of the contributions and the limitations of this study.

2. Materials and Methods

2.1. Dataset

2.1.1. Dataset Collection

PCB defect detection technology is mainly used for its image processing abilities to identify defects, and the efficacy of a detection model is largely contingent upon the quality of the dataset used. At present, various standards exist for PCB defects. The IPC standard, established by the U.S. Electronics Industry Connection Association, has emerged as a widely recognized benchmark within the printed circuit board industry. IPC standards [14], known for their adaptability and versatility, are extensively employed in the electronics sector to foster standardization and safety in electronic assembly while also offering critical technical guidance. This study utilizes the HRIPCB [15] dataset, publicly released by Peking University, which adheres to the IPC standard. The HRIPCB dataset comprises 1386 images of PCB defects, categorized into six types: missing_hole, mouse_bites, open circuits, short, spur, and spurious_copper.

2.1.2. Dataset Augmentation

Given the small sample size of this dataset, overfitting is a potential issue during model training. To address this issue, the dataset is augmented through highlighting, rotating, and cropping techniques, as illustrated in Figure 1. These data enhancement strategies aim to improve the model’s performance. Following data enhancement, the initial dataset, comprising 1386 images, is increased to 10,668 images. And the total number of different types of defects in the expanded dataset reaches 19,854.

2.2. Methods

2.2.1. Bidirectional Feature Pyramid Network (BIFPN)

The desire for precise and rapid defect identification in PCB detection scenarios necessitates more advanced feature fusion mechanisms. YOLOv8 still adopts the idea of the path aggregation network (PANet [16]) structure within the Neck, as illustrated in Figure 2b. In contrast to the unidirectional, top-down feature pyramid network (FPN) [17] structure shown in Figure 2a, PANet is a bidirectional pathway network. It incorporates a bottom-up path in addition to the FPN, resulting in more efficient feature propagation. However, PANet networks demand greater computational resources, leading to relatively slower processing speeds and suboptimal performance for real-time target detection tasks. Furthermore, PANet utilizes a bottom-up path aggregation network to improve information flow. This approach may degrade detection accuracy if the low-level feature information is insufficient or partially lost [18].
Based on previous research on feature fusion, Mingxing Tan et al. from Google’s BrainTeam proposed a novel architecture, EfficientDet, which newly proposes an efficient weighted bidirectional feature pyramid network (BiFPN) [19] in the Neck. The BIFPN introduces learnable weights to assess the significance of various input features and performs multi-scale feature fusion efficiently. This is achieved through the following strategies (the structure of the BiFPN is depicted in Figure 2c): Firstly, the bidirectional network is simplified by eliminating nodes with input edges that do not contribute to feature fusion, thereby enhancing the feature network’s fusion process. Secondly, an additional edge is introduced between the input and output nodes to address scenarios where both are located in the same layer. Finally, an adaptive weighting mechanism is employed, enabling the model to learn the contribution of each input feature based on the learned weights, thereby achieving more accurate PCB defect detection results.

2.2.2. FasterNet

To fulfill the stringent demands of PCB defect detection, particularly in terms of accuracy and real-time performance, this study substitutes the CSPDarkNet [20] feature extraction network in YOLOv8 with FasterNet, significantly reducing the model’s computational complexity while enhancing the detection speed. FasterNet, proposed by Chen et al. [21] in 2023, is a lightweight network designed with the core principle of enhancing feature representation capabilities while preserving a high speed and lightweight characteristics. The structure of FasterNet is illustrated in Figure 3. The primary architecture of FasterNet comprises four stages, each containing a FasterNet Block, which includes a PConv layer followed by two 1 × 1 convolutional layers, with an embedding or merging layer being positioned before each convolutional layer. Compared with the backbone feature extraction network of YOLOv8, FasterNet uses a new convolution operator, PConv (partial convolution), as well as PWConv (point-by-point convolution) as the principal operator. This results in enhanced detection accuracy and speed, alongside reductions in memory access and computational redundancy. The FasterNet Block serves as the fundamental building module of this network. It features an inverted residual structure, where the middle PWConv expands channels and leverages shortcut connections to reutilize input features. Subsequently, batch normalization (BN) and the activation layer (ReLU) are integrated between the two PWConvs to preserve feature diversity and minimize latency. Finally, a global average pooling layer, followed by a 1 × 1 convolutional layer and a fully connected layer, is employed for feature transformation and classification. Partial convolution selectively performs convolution operations on a subset of input channels, leaving the remaining channels untouched. The floating-point calculation for the PConv component is presented in Equation (1):
FLOPs = h × w × k 2 × c p 2
where h is the height of the channel, w is the width of the channel, k is the filter, and c p is a continuous network channel.
Compared to the backbone feature extraction network of YOLOv8, the lightweight FasterNet, designed with PConv and PWConv architectures, enhances the detection accuracy and speed while simultaneously minimizing memory access and computational redundancy, thereby enabling rapid and efficient PCB defect detection.

2.2.3. RepHead Based on Structural Re-Parameterization Construction

When detecting small defects on PCB surfaces, the performance of the detection head is pivotal to the accuracy and efficiency of the model. An effective detection head can extract target information from input features more accurately, leading to more accurate predictions. To this end, we introduce a re-parameterization method. RepVGG [22] converts trained multi-branch models into single-branch inference models by utilizing re-parameterization techniques. Building upon this concept, we design a re-parameterization structure named RepConv and propose an efficient detection head termed RepHead [23]. A comparison between its structure and the YOLOv8 detector head is presented in Figure 4. The original model’s 3 × 3 convolution and 1 × 1 convolution are amalgamated into a new module, RepConv, through re-parameterization. During the training phase, RepConv employs a multi-branch structure, which facilitates the network’s learning and enhances its expressive capacity. This innovative method addresses the issues of feature sparsity and information loss due to the small sizes of defects on the PCB surface, thereby enabling the model to identify these defects more effectively. It reduces the model’s parameter count while enhancing the detection accuracy and significantly improving the detection speed.

2.2.4. Varifocal Loss

Since PCB defects predominantly consist of small targets of varying sizes, YOLOv8 uses the Binary CrossEntropYLoss (BCELoss) [24] as the classification loss function to mitigate the impact of class imbalance during the training process, which is defined by Equation (2):
B C E L ( p , y ) = log ( p ) i f   y = 1 log ( 1 p )     otherwise
where p is the predicted label and y is the true label.
Given that the dense detector must analyze every position within an image, positive samples (detection targets) constitute only a minute fraction of the total, with the majority being negative samples (background). The overwhelming number of negative samples dominates the gradient contribution process, thereby affecting the model’s capacity for accurate predictions. Focal Loss [25] addresses the imbalance in the handling of positive and negative samples by introducing a weighting factor α and a modulation factor, enabling the model to focus more on detecting densely distributed and difficult-to-detect samples during training, as defined by Equation (3):
F L ( p , y ) = α ( 1 p ) y   log ( p )   if   y = 1 ( 1 α ) p γ   log ( 1 p )     otherwise
However, the above factors primarily reduce the loss of easily classifiable samples without fully leveraging the gradient contributions from both positive and negative samples. Given that the current model relies on both target classification information and location to achieve optimal results, we employ Varifocal Loss [26], which not only dynamically adjusts the weights of negative samples to balance their overwhelming impact on predictions but also preserves the extraction of positive samples. This enhances the model’s learning capacity and achieves superior PCB defect detection performance. Varifocal Loss is defined through Equation (4):
V F L ( p , y ) = q ( q log ( p ) + ( 1 q ) log ( 1 p ) q > 0 α p γ   log ( 1 p )   q = 0
where p is the perceptual classification score (IACS) [27], q is the object score, γ is the modulation factor, and α is the weighting factor.

2.2.5. YOLO-BRFV Model

Based on the analyses in Section 2.2.1, Section 2.2.2, Section 2.2.3 and Section 2.2.4, we present the improved model of this study, with its structure illustrated in Figure 5. First, the BIFPN is incorporated into the Neck layer, replacing the original PANet, which enhances the algorithm’s target detection and classification performance. Second, the lightweight FasterNet is integrated into the Backbone, replacing the CSPDarkNet in the original model, thereby reducing computational delay and improving efficiency while enhancing detection accuracy. Additionally, this study reconstructs the re-parameterized detection head, replacing the original Head, thereby enhancing the model’s ability to capture small target details. Finally, Varifocal Loss is employed to replace the original loss function, significantly enhancing the detection accuracy for densely distributed defects.

2.3. Experimental Parameters and Environment

The experiment utilizes the Pytorch 1.3.0 framework and CUDA version 11.3 for training, with YOLOv8 serving as the base model, as shown in Table 1.
The configuration of hyperparameters significantly impacts the network’s prediction outcomes. Hyperparameters are values predefined before neural network training and are not derived from the sample data, meaning they are not data driven. This study evaluates the impact of hyperparameters and related strategies on model performance, including the batch size, initial learning rate, learning strategy, input image resolution, and optimizer choice.
For the batch size, we compared values of 8, 32, and 64 on the test set, ultimately determining that a batch size of 8 yielded the best model performance.
The learning rate greatly influences model convergence and performance, and its configuration is closely tied to the stability of the model during training. After a comparison, we set the initial learning rate to 0.01.
A higher input image resolution generally results in better model performance; however, it also increases the training iteration time. Considering this trade-off, the chosen input image resolution for this study is 640 × 640.
With a learning rate of 0.01, a batch size of 8, and an input image resolution of 640 × 640, a comparison between the SGD optimizer and Adam (Adaptive Moment Estimation) [28] optimizer revealed that the model failed to converge using SGD. Therefore, this study adopts the Adam optimizer.
During the training process, a training cycle (epoch) represents one complete pass of the dataset through the neural network. Typically, a total of 200 training cycles is used for small- to medium-sized datasets, yielding optimal results in most cases.

2.4. Model Evaluation Metrics

To comprehensively verify the effectiveness of the PCB defect detection model, the mean Average Precision (mAP) is commonly used as the evaluation metric. The mAP is calculated using precision (P) and recall (R), as shown in Equations (5) and (6).
P = T P T P + F P
R = T P T P + F N
In multi-class target detection, the average precision (AP) for each target class is typically calculated separately and then averaged to obtain the model’s mAP, as illustrated in Equations (7) and (8). The mAP value ranges from 0 to 1, with values closer to 1 indicating better model performance and higher detection accuracy. The detection speed of a model is typically measured in frames per second (FPSs), indicating the number of frames detected per second, as shown in Equation (9).
A P = 0 1 P R d R
m A P = i = 1 k A P i k
F P S = F r a m e n u m E l a p s e d T i m e

3. Results

3.1. Comparison of Different Benchmark Models

3.1.1. Experimental Results of HIRIPCB

Current target detection algorithms are primarily categorized into one-stage and two-stage algorithms. Two-stage target detection algorithms, like R-CNN [28], SPN-Net [29], Fast R-CNN [30] and FasterR-CNN [31], rely on candidate regions, while one-stage target detection algorithms, such as YOLO [32] and SSD [33], are based on regression. Two-stage target detection algorithms require a series of candidate regions to be generated. Although they offer high accuracy, their detection speed is slow, making real-time detection tasks challenging. In contrast, one-stage algorithms bypass the candidate region generation step, resulting in faster detection speeds but poorer performance in detecting small targets. Given that PCB defect detection must satisfy both accuracy and real-time requirements, this study enhances the detection accuracy and speed by refining the YOLOv8 model. While maintaining the same training platform, environment, and dataset, we compare the experimental results of FasterR-CNN from the two-stage algorithm and YOLOv5, YOLOv7 [34], and YOLOv8s from the one-stage algorithm YOLO series. Additionally, we added the RT-DETR [35] algorithm for comparison, which is more effective in target detection. The experimental results are presented in Table 2.
Compared to Faster-RCNN, the improved model in this study increases precision by 10.9 percentage points, recall by 5.9 percentage points, and mAP by 16.4% and reduces the number of parameters by 72%. Additionally, the model’s mAP improves by 2.9% compared to the RT-DETR algorithm while significantly reducing the number of parameters. Regarding the YOLO series algorithms, the improved model in this study also achieves strong results compared to YOLOv5, YOLOv7, and YOLOv8s, with the mAP values increasing by 6.3%, 3.9%, and 4.1%, respectively. The experimental results indicate that current models for PCB defect detection possess limitations, often resulting in misdetections and omissions. In this study, the improved YOLOv8 model introduces the BIFPN to strengthen feature extraction capabilities and employs Varifocal Loss to further enhance small target detection. In terms of parameter count, the model in this study reduces parameters by 78% compared to the benchmark model due to the use of PConv in FasterNet and RepConv in RepHead. Overall, the improved YOLOv8 model proposed in this study demonstrates robust comprehensive performance, enhancing the defect detection accuracy while maintaining an efficient detection speed, thereby providing a solid foundation for PCB defect detection in industrial applications.
Figure 6 compares the confusion matrices of the YOLO series algorithms. The diagonal elements represent the number of samples correctly predicted by the model, while the off-diagonal elements represent the number of incorrectly detected or missed samples. As observed in the figure, missing_hole and spurious_copper exhibit relatively high detection rates compared to the other categories, whereas short and spur exhibit higher rates of missed detections, demonstrating less effectiveness in comparison.
Figure 7 provides a detailed comparison of the detection outcomes between the proposed model and various algorithms discussed in this study. It is apparent that the benchmark model, YOLOv8s, faces considerable difficulties with false positives and missed detections. Specifically, the two defects—mouse bites and circuit openings—share similar visual characteristics, which heightens the risk of erroneous detections. This study addresses this issue by employing the BIFPN, which substantially improves the detection accuracy for visually similar targets. Moreover, the features of spur defects are particularly difficult to distinguish from the background. To address this challenge, Varifocal Loss is introduced, which adaptively adjusts the Focal Loss according to the complexity of the detection task. The model proposed in this study demonstrates superior effectiveness in detecting minute defects and exhibits an enhanced detection speed in comparison to the recently introduced target detection algorithm, RT-DETR.

3.1.2. Experimental Results of DeepPCB

Additionally, relying on a single dataset is insufficient to assess the model’s generalization capability. Therefore, we extended our evaluation by incorporating another publicly available black-and-white image dataset, DeepPCB [36]. The images were captured using linear scanning Charge-Coupled Devices (CCDs), resulting in a dataset comprising 1500 images, each with a resolution of 640 × 640 pixels. The defect types in this dataset are consistent with those in the HRIPCB dataset, encompassing six distinct defect categories. Experiments were conducted utilizing the YOLOv8n, YOLOv7-tiny, RT-DETR, and YOLO-BFRV algorithms, with the corresponding results presented in Figure 8.
As shown in Figure 8, the YOLO-BFRV model achieves a mean Average Precision (mAP) of 98.6% on the DeepPCB dataset, representing improvements of 5.4%, 0.4%, and 3% over the YOLOv7-tiny, RT-DETR, and YOLOv8n models, respectively. The model comprises 2.9 million parameters, which is significantly smaller than other models, reflecting a 29% reduction compared to the baseline model. These results demonstrate that the YOLO-BFRV algorithm is not only effective with the HIRIPCB dataset, showcasing superior detection capabilities, but also performs robustly with the DeepPCB dataset, further validating the efficacy of the proposed algorithm. Selected test results from the improved model are presented in Figure 9.

3.2. Results of Ablation Experiments

To comprehensively evaluate the proposed model’s validity and feasibility, the performance of each component was rigorously assessed through ablation experiments. Given that the proposed model in this study is based on YOLOv8s, the YOLOv8s model was utilized as the benchmark for conducting the ablation experiments. The experiments utilized precision (P), recall (R), mean Average Precision (mAP), frames per second (FPS), and the total number of model parameters (GFLOPS) as evaluation metrics. The corresponding experimental results are presented in Table 3.
The following conclusions were derived from the ablation experiments:
(1)
The benchmark model exhibits the lowest detection accuracy due to the presence of spurs, spurious_copper, and other small target defects within the dataset, which are challenging to identify, leading to a lower overall detection accuracy.
(2)
Model C achieves a significant boost in detection speed after upgrading the backbone to FasterNet. However, the computational load is slightly increased due to the inclusion of PConv in its architecture. Models B, D, and E show varying degrees of improvement in detection accuracy and speed after the integration of sub-modules.
(3)
Models F, G, and H, which incorporate BIFPN into the original architecture, demonstrate higher accuracy and a slight increase in detection speed compared to the traditional PANet structure in the original Neck component.
(4)
After integrating all of the improved modules, Model I shows enhanced feature extraction and fusion capabilities by effectively suppressing irrelevant information. Consequently, the overall performance of the model surpasses that of the baseline, particularly in detecting smaller targets.

3.3. Loss Function Comparison Experiments

Varifocal Loss adjusts the contribution of negative samples to the loss without diminishing the loss of positive samples during training, thereby enhancing the generalizability and stability of the PCB defect detection model, which, in turn, improves the training accuracy. Focal Loss is particularly suitable for tasks with category imbalance, especially in scenarios with significant disparities between object and background ratios in target detection. It primarily addresses the imbalance between positive and negative samples by adjusting their weights as well as the weights of hard-to-classify samples. SlideLoss [37] employs a sliding window-based strategy that focuses on difficult defect samples, particularly those located at boundaries during training. This approach is mainly suitable for tasks requiring fine-grained, pixel-level classification, such as semantic segmentation, where it excels in boundary processing. Quality Focal Loss [38] enhances Focal Loss by integrating classification scores with the IoU of detection frames and transforming the target labels into continuous values. It adjusts the classification weights of both difficult and easy samples, making it particularly effective for improving the prediction quality. To further validate the superiority of Varifocal Loss, comparative experiments were conducted using Slide Loss, Focal Loss, and Quality Focal Loss. The experimental results, presented in Table 4, were obtained using mAP50%, Precision (P), and Recall (R) as performance metrics, with their comparisons being illustrated in Figure 10. The results demonstrate that Varifocal Loss, as utilized in this study, achieves the highest accuracy.
Based on the comparative experiments of the loss functions, the following conclusions can be drawn:
(1)
As illustrated in the figure, the loss function proposed in this paper demonstrates robustness in detecting various types of small PCB defects and exhibits terrific generalization capability.
(2)
As shown in Table 4, the mAP values of Varifocal Loss are 5.4%, 4%, and 3.1% higher than those of Focal Loss, Quality Focal Loss, and Slide Loss, respectively.

4. Discussion

This paper proposes a lightweight PCB defect detection model, YOLO-BFRV, which builds upon the improved YOLOv8 architecture. To address the challenge of complex PCB backgrounds that hinder the model’s ability to extract various defective features effectively, the bidirectional feature pyramid network (BIFPN) is first incorporated to enhance feature extraction capabilities. Subsequently, FasterNet is integrated into the backbone network, improving the detection speed and accuracy while further reducing the model’s inference complexity. A re-parameterized detection header is then introduced to enhance the detection of small target defects while reducing computational parameters. Finally, the loss function is replaced with Varifocal Loss, further enhancing the model’s stability and improving its generalization ability. The proposed model also demonstrates excellent detection performance in the real-time monitoring of PCB defects, achieving an FPS of 142.5 and a mAP of 98.4%, which is 4.12% higher than the benchmark model YOLOv8s.
Although the YOLO-BFRV model proposed in this paper enhances the detection accuracy and speed of PCB defects, its performance on large-scale industrial public datasets requires further validation. When applied to actual production, the model demands high hardware performance, making it challenging to implement considering the cost and current working environment. Therefore, future research will focus on improving the model’s generalization and stability to enhance its effectiveness and practicality in industrial PCB defect detection applications.

Author Contributions

Conceptualization, J.L. and Y.B.; methodology, J.L.; software, B.K.; validation, C.L. and X.P.; formal analysis, X.P.; investigation, B.K.; resources, J.L.; data curation, J.L.; writing—original draft preparation, J.L. and Y.B.; writing—review and editing, J.L. and Y.B.; visualization, J.L.; supervision, Y.B. and X.P.; project administration, Y.B. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The data are contained within the article.

Acknowledgments

We would like to thank the anonymous reviewers for their constructive and valuable suggestions on the earlier drafts of this manuscript.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Tan, Q.; Liu, L.; Yu, M.; Li, J. An innovative method of recycling metals in printed circuit board (PCB) using solutions from PCB production. J. Hazard. Mater. 2020, 390, 121892. [Google Scholar] [CrossRef] [PubMed]
  2. Chaudhary, V.; Dave, I.R.; Upla, K.P. Automatic visual inspection of printed circuit board for defect detection and classification. In Proceedings of the 2017 International Conference on Wireless Communications, Signal Processing and Networking (WiSPNET), Chennai, India, 22–24 March 2017; IEEE: Piscataway, NJ, USA, 2017; pp. 732–737. [Google Scholar]
  3. Li, Y.; Li, S. Defect detection of bare printed circuit boards based on gradient direction information entropy and uniform local binary patterns. Circuit World 2017, 43, 145–151. [Google Scholar] [CrossRef]
  4. Abd Al Rahman, M.; Mousavi, A. A review and analysis of automatic optical inspection and quality monitoring methods in electronics industry. IEEE Access 2020, 8, 183192–183271. [Google Scholar]
  5. Cao, G.; Ruan, S.; Peng, Y.; Huang, S.; Kwok, N. Large-complex-surface defect detection by hybrid gradient threshold segmentation and image registration. IEEE Access 2018, 6, 36235–36246. [Google Scholar] [CrossRef]
  6. Li, R.; Tian, F.; Chen, S. Research on double edge detection method of midsole based on improved Otsu method. IEEE Access 2020, 8, 221539–221552. [Google Scholar] [CrossRef]
  7. Lyu, R.; Lu, J.; Zhao, Z.; Zhang, Y.; Han, J.; Bai, L. Welding defects on new energy batteries based on 2D pre-processing and improved-region-growth method in the small field of view. Meas. Sci. Technol. 2023, 35, 015409. [Google Scholar] [CrossRef]
  8. Xia, B.; Cao, J.; Wang, C. SSIM-NET: Real-time PCB defect detection based on SSIM and MobileNet-V3. In Proceedings of the 2019 2nd World Conference on Mechanical Engineering and Intelligent Manufacturing (WCMEIM), Shanghai, China, 22–24 November 2019; IEEE: Piscataway, NJ, USA, 2019; pp. 756–759. [Google Scholar]
  9. Liu, G.; Wen, H. Printed circuit board defect detection based on MobileNet-Yolo-Fast. J. Electron. Imaging 2021, 30, 043004. [Google Scholar] [CrossRef]
  10. 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. [Google Scholar] [CrossRef]
  11. Lim, J.; Lim, J.; Baskaran, V.M.; Wang, X. A deep context learning based PCB defect detection model with anomalous trend alarming system. Results Eng. 2023, 17, 100968. [Google Scholar] [CrossRef]
  12. Hua, C.; Zou, X.; Ling, Y.; Chen, Y. Visual saliency detection via a recurrent residual convolutional neural network based on densely aggregated features. Comput. Graph. 2022, 104, 72–85. [Google Scholar] [CrossRef]
  13. Park, J.-Y.; Hwang, Y.; Lee, D.; Kim, J.-H. MarsNet: Multi-label classification network for images of various sizes. IEEE Access 2020, 8, 21832–21846. [Google Scholar] [CrossRef]
  14. 2019-01-1253; Securing Printed Board Performance and Assembly Reliability in Automotive Applications through IPC Standards. SAE: Warrendale, PA, USA, 2019.
  15. Huang, W.; Wei, P.; Zhang, M.; Liu, H. HRIPCB: A challenging dataset for PCB defects detection and classification. J. Eng. 2020, 2020, 303–309. [Google Scholar] [CrossRef]
  16. Liu, S.; Qi, L.; Qin, H.; Shi, J.; Jia, J. Path aggregation network for instance segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–23 June 2018; pp. 8759–8768. [Google Scholar]
  17. Lyu, H.; Qiu, F.; An, L.; Stow, D.; Lewison, R.; Bohnett, E. Deer survey from drone thermal imagery using enhanced faster R-CNN based on ResNets and FPN. Ecol. Inform. 2024, 79, 102383. [Google Scholar] [CrossRef]
  18. He, Z.; Gong, P.; Ye, H.; Gan, Z. Lane Attribute Classification Based on Fine-Grained Description. Sensors 2024, 24, 4800. [Google Scholar] [CrossRef] [PubMed]
  19. Tan, M.; Pang, R.; Le, Q.V. Efficientdet: Scalable and efficient object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 13–19 June 2020; pp. 10781–10790. [Google Scholar]
  20. Yin, L.; Zainudin, M.; Saad, W.; Sulaiman, N.; Idris, M.; Kamarudin, M.; Mohamed, R.; Razak, M. Analysis Recognition of Ghost Pepper and Cili-Padi using Mask-RCNN and YOLO. Prz. Elektrotechniczny 2023, 2023, 92. [Google Scholar] [CrossRef]
  21. Chen, J.; Kao, S.-H.; He, H.; Zhuo, W.; Wen, S.; Lee, C.-H.; Chan, S.-H.G. Run, don’t walk: Chasing higher FLOPS for faster neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June 2023; pp. 12021–12031. [Google Scholar]
  22. Ding, X.; Zhang, X.; Ma, N.; Han, J.; Ding, G.; Sun, J. Repvgg: Making vgg-style convnets great again. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Nashville, TN, USA, 20–25 June 2021; pp. 13733–13742. [Google Scholar]
  23. Hu, X.; Kong, D.; Liu, X.; Zhang, J.; Zhang, D. FM-STDNet: High-speed detector for fast-moving small targets based on deep first-order network architecture. Electronics 2023, 12, 1829. [Google Scholar] [CrossRef]
  24. Wu, T.; Gao, G.; Huang, J.; Wei, X.; Wei, X.; Liu, C.H. Adaptive spatial-bce loss for weakly supervised semantic segmentation. In Proceedings of the European Conference on Computer Vision, Tel Aviv, Israel, 23–27 October 2022; Springer: Berlin/Heidelberg, Germany, 2022; pp. 199–216. [Google Scholar]
  25. Lin, T.-Y.; Goyal, P.; Girshick, R.; He, K.; Dollár, P. Focal loss for dense object detection. In Proceedings of the IEEE International Conference on Computer Vision, Venice, Italy, 22–29 October 2017; pp. 2980–2988. [Google Scholar]
  26. Zhang, H.; Wang, Y.; Dayoub, F.; Sunderhauf, N. Varifocalnet: An iou-aware dense object detector. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Nashville, TN, USA, 20–25 June 2021; pp. 8514–8523. [Google Scholar]
  27. Wu, S.; Li, X.; Wang, X. IoU-aware single-stage object detector for accurate localization. Image Vis. Comput. 2020, 97, 103911. [Google Scholar] [CrossRef]
  28. Agrawal, P.; Girshick, R.; Malik, J. Analyzing the performance of multilayer neural networks for object recognition. In Proceedings of the Computer Vision–ECCV 2014: 13th European Conference, Zurich, Switzerland, 6–12 September 2014; Proceedings, Part VII 13, 2014. Springer: Berlin/Heidelberg, Germany, 2014; pp. 329–344. [Google Scholar]
  29. He, K.; Zhang, X.; Ren, S.; Sun, J. Spatial pyramid pooling in deep convolutional networks for visual recognition. IEEE Trans. Pattern Anal. Mach. Intell. 2015, 37, 1904–1916. [Google Scholar] [CrossRef]
  30. Girshick, R. Fast r-cnn. In Proceedings of the IEEE International Conference on Computer Vision, Santiago, Chile, 7–13 December 2015; pp. 1440–1448. [Google Scholar]
  31. 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. IEEE Trans. Pattern Anal. Mach. Intell. 2016, 39, 1137–1149. [Google Scholar] [CrossRef]
  32. Plastiras, G.; Kyrkou, C.; Theocharides, T. You only look once: Unified, real-time object detection. In Proceedings of the ACM International Conference on Interactive Surfaces and Spaces, New York, NY, USA, 25–28 November 2018. [Google Scholar]
  33. 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; Proceedings, Part I 14, 2016. Springer: Berlin/Heidelberg, Germany, 2016; pp. 21–37. [Google Scholar]
  34. 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. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June 2023; pp. 7464–7475. [Google Scholar]
  35. Zhao, Y.; Lv, W.; Xu, S.; Wei, J.; Wang, G.; Dang, Q.; Liu, Y.; Chen, J. Detrs beat yolos on real-time object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, DC, USA, 17–21 June 2024; pp. 16965–16974. [Google Scholar]
  36. Tang, S.; He, F.; Huang, X.; Yang, J. Online PCB defect detector on a new PCB defect dataset. arXiv 2019, arXiv:1902.06197. [Google Scholar]
  37. Yu, Z.; Huang, H.; Chen, W.; Su, Y.; Liu, Y.; Wang, X. YOLO-FaceV2: A Scale and Occlusion Aware Face Detector. arXiv 2022, arXiv:2208.02019. [Google Scholar] [CrossRef]
  38. Li, X.; Wang, W.; Wu, L.; Chen, S.; Hu, X.; Li, J.; Tang, J.; Yang, J. Generalized focal loss: Learning qualified and distributed bounding boxes for dense object detection. Adv. Neural Inf. Process. Syst. 2020, 33, 21002–21012. [Google Scholar]
Figure 1. Results of augmentation. (a) Image after brightening; (b) image after revolving; (c) image after cropping.
Figure 1. Results of augmentation. (a) Image after brightening; (b) image after revolving; (c) image after cropping.
Sensors 24 06055 g001
Figure 2. Structure of FPN and BIFPN.
Figure 2. Structure of FPN and BIFPN.
Sensors 24 06055 g002
Figure 3. FasterNet structure.
Figure 3. FasterNet structure.
Sensors 24 06055 g003
Figure 4. Structure of YOLOv8 detect head and RepHead.
Figure 4. Structure of YOLOv8 detect head and RepHead.
Sensors 24 06055 g004
Figure 5. YOLO-BFRV network model structure.
Figure 5. YOLO-BFRV network model structure.
Sensors 24 06055 g005
Figure 6. Confusion matrices for (a) YOLOv5; (b) YOLOv7; (c) YOLOv8; and (d) OURS.
Figure 6. Confusion matrices for (a) YOLOv5; (b) YOLOv7; (c) YOLOv8; and (d) OURS.
Sensors 24 06055 g006
Figure 7. The detection results of the different models. (a) The results of the YOLOv8s model; (b) the results of the RT-DETR model; and (c) the results of the YOLO-BFRV model.
Figure 7. The detection results of the different models. (a) The results of the YOLOv8s model; (b) the results of the RT-DETR model; and (c) the results of the YOLO-BFRV model.
Sensors 24 06055 g007aSensors 24 06055 g007b
Figure 8. Experimental results of different models.
Figure 8. Experimental results of different models.
Sensors 24 06055 g008
Figure 9. YOLO-BFRV defect detection results.
Figure 9. YOLO-BFRV defect detection results.
Sensors 24 06055 g009
Figure 10. Experimental results of loss function comparison.
Figure 10. Experimental results of loss function comparison.
Sensors 24 06055 g010
Table 1. Experimental environment configuration.
Table 1. Experimental environment configuration.
ProgramsSettings
Operating systemUbuntu
CPUIntel(R) Xeon(R) Gold 6326 CPU @ 2.90GHz (Intel, Santa Clara, CA, USA)
GPUNVIDIA A100 100GB PCIe (Nvidia, Santa Clara, CA, USA)
RAM100 GB
Python version3.7
Table 2. Experimental results of different models.
Table 2. Experimental results of different models.
ModelmAP@50/%P/%R/%Parameter Size
FasterR-CNN84.587.392.724.59 M
YOLOv592.588.193.67.1 M
YOLOv794.789.394.337.1 M
YOLOv8s94.592.695.130.2 M
RT-DETR95.693.595.938.5 M
OURS98.496.998.26.7 M
Table 3. Ablation experiments.
Table 3. Ablation experiments.
ModelBIFPNFasterNetRepHeadVarifocalLossmAP@50/%P/%R/%fps/sGFLOPS
A 94.592.695.197.46.3
B 96.39496.2102.16.6
C 97.49695.6134.210.7
D 97.796.596.1107.26.9
E 95.694.693.898.66.3
F 97.495.996.6138.58.2
G 96.594.697.2118.28.6
H 96.996.495.2109.27.1
I98.496.998.2142.111.5
Table 4. Results of loss function comparison experiments.
Table 4. Results of loss function comparison experiments.
Loss FunctionmAP50/%P/%R/%
Focal Loss90.291.488.5
Quality Focal Loss91.688.989.7
Slide Loss92.590.690.5
Varifocal Loss95.694.693.8
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Liu, J.; Kang, B.; Liu, C.; Peng, X.; Bai, Y. YOLO-BFRV: An Efficient Model for Detecting Printed Circuit Board Defects. Sensors 2024, 24, 6055. https://doi.org/10.3390/s24186055

AMA Style

Liu J, Kang B, Liu C, Peng X, Bai Y. YOLO-BFRV: An Efficient Model for Detecting Printed Circuit Board Defects. Sensors. 2024; 24(18):6055. https://doi.org/10.3390/s24186055

Chicago/Turabian Style

Liu, Jiaxin, Bingyu Kang, Chao Liu, Xunhui Peng, and Yan Bai. 2024. "YOLO-BFRV: An Efficient Model for Detecting Printed Circuit Board Defects" Sensors 24, no. 18: 6055. https://doi.org/10.3390/s24186055

APA Style

Liu, J., Kang, B., Liu, C., Peng, X., & Bai, Y. (2024). YOLO-BFRV: An Efficient Model for Detecting Printed Circuit Board Defects. Sensors, 24(18), 6055. https://doi.org/10.3390/s24186055

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop