PCB defect intelligent detection system based on YOLOv8n-BMR

By introducing a two-layer routing attention mechanism module and a multi-scale feature fusion module in the YOLOv8n-BMR model, combined with Ratio-IOU Loss, the problems of missing detection and reduced accuracy in PCB defect detection are solved, and higher detection accuracy and robustness are achieved.

CN120125518APending Publication Date: 2025-06-10YANCHENG INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510179248.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-18
Publication Date
2025-06-10

AI Technical Summary

Technical Problem

The prior art has problems of missed detection and reduced accuracy in PCB defect detection, especially when dealing with small target defects.

Method used

The PCB defect intelligent detection system based on YOLOv8n-BMR is adopted, and the model is optimized by introducing a two-layer routing attention mechanism module (BRA) and a multi-scale feature fusion module (MSFF) and combining Ratio-IOU Loss.

Benefits of technology

It improves the detection accuracy of small target defects, reduces false detection and missed detection, enhances the model's understanding of complex scenarios, and meets the requirements of industrial real-time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120125518A_ABST
    Figure CN120125518A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of PCB defect detection, in particular to an intelligent PCB defect detection system based on YOLOv8n-BMR, which comprises the following steps: constructing a YOLOv8n-BMR model which comprises a double-layer routing attention mechanism module (BRA) and a multi-scale feature fusion module (MSFF); the Ratio-IOU Loss is introduced to carry out optimization on the model; training the model by using the constructed data set; the trained model is applied to PCB defect detection, the BRA and MSFF modules are introduced, the detection precision of small target defects is improved, the phenomena of false detection and missing detection are reduced, multi-scale feature fusion enables the model to better adapt to defects of different scales and shapes, and the robustness of the system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of PCB defect detection, and particularly to a PCB defect intelligent detection system based on YOLOv8n-BMR. Background Art

[0002] With the continuous progress of technology, the printed circuit board (PCB) in modern electronic devices has become the core to ensure efficient connection and communication among various electronic components. As a key determinant of product reliability and performance, the quality control of PCB becomes particularly crucial. In the process of quality assurance, defect detection plays an indispensable role, aiming to identify those defects that may affect the function and stability of the final product.

[0003] In dealing with the unique defects on the surface of the PCB board, most of the existing studies fail to fully consider enhancing the model's understanding ability of diverse and complex scenarios, as well as how to effectively fuse multi-scale features to obtain richer and more representative feature expressions. This leads to the omission of certain defects and the decline in the accuracy of specific defect detection models, thus affecting the overall performance of the model. And the YOLO series has always relied on Anchor Boxes to help the model predict the position and size of the target before the emergence of YOLOv8. However, this is restricted by the selection and matching of anchor boxes. In YOLOv8, a more advanced Anchor-Free strategy is adopted, directly regressing the target without relying on fixed-size anchor boxes. The advantage of the Anchor-Free method is that the model is no longer restricted by the selection of anchor boxes, reducing the computational complexity and improving the detection accuracy. This makes YOLOv8 perform more stably in various application scenarios. Especially when facing dynamic changes and complex scenarios, it can better adapt to different target sizes and shapes. But there are problems such as poor effect and insufficient accuracy in detecting small target defects of PCB.

[0004] In view of this, a PCB defect intelligent detection system based on YOLOv8n-BMR is provided to overcome the above defects. Summary of the Invention

[0005] The purpose of the present invention is to solve the deficiencies existing in the prior art, and a PCB defect intelligent detection system based on YOLOv8n-BMR is proposed.

[0006] To achieve the above purpose, the present invention adopts the following technical solutions: A PCB defect intelligent detection system based on YOLOv8n-BMR, including the following steps:

[0007] Build the YOLOv8n-BMR model, which includes a bilayer routing attention mechanism module (BRA) and a multi-scale feature fusion module (MSFF);

[0008] Introduce Ratio-IOU Loss to optimize the model;

[0009] Use the constructed dataset to train the model; Apply the trained model to PCB defect detection.

[0010] Preferably in the above solution, the bilayer routing attention mechanism module (BRA) improves the detection accuracy of small-size defects by retaining fine-grained information in the feature extraction process.

[0011] Preferably in the above solution, the multi-scale feature fusion module (MSFF) enhances the model's understanding ability of complex scenes by integrating feature information of different scales.

[0012] Preferably in the above solution, the Ratio-IOU Loss optimizes the bounding box localization and improves the detection accuracy by adjusting the size of the auxiliary bounding box.

[0013] Preferably in the above solution, it includes a data preprocessing module, a YOLOv8n-BMR model module, and a result output module; The data preprocessing module is used to preprocess the input PCB image; The YOLOv8n-BMR model module is used to detect defects in the preprocessed image; The result output module is used to output the detection result.

[0014] Preferably in the above solution, the YOLOv8n-BMR model module includes a bilayer routing attention mechanism module (BRA) and a multi-scale feature fusion module (MSFF).

[0015] Preferably in the above solution, it further includes a training module for training the YOLOv8n-BMR model using the constructed dataset.

[0016] Preferably in the above solution, the result output module further includes a visualization module for presenting the detection result to the user in a visual way.

[0017] A computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements any one of the above PCB defect intelligent detection systems based on YOLOv8n-BMR.

[0018] An electronic device, including a processor and a storage medium, on which a computer program is stored, and when the program is executed by the processor, it implements the above PCB defect intelligent detection system based on YOLOv8n-BMR.

[0019] The present invention has the following beneficial effects:

[0020] 1. In the present invention, by introducing the BRA and MSFF modules, the detection accuracy of small target defects is improved, and the phenomena of false detection and missed detection are reduced.

[0021] 2. In the present invention, multi-scale feature fusion enables the model to better adapt to defects of different scales and shapes, improving the robustness of the system.

[0022] 3. In the present invention, YOLOv8n, as a representative of single-stage detection algorithms, has the advantages of fast detection speed and less computational complexity, enabling the system to meet the industrial real-time requirements.

[0023] 4. In the present invention, the designed system has a user-friendly interface, is simple and convenient to operate, and can be widely applied to the quality inspection link of PCB manufacturing enterprises. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 It is the structural diagram of the YOLOv8n-BMR network in the present invention;

[0025] Figure 2 It is the structural diagram of the BRA module in the present invention;

[0026] Figure 3 It is the structural diagram of the MSFF module in the present invention;

[0027] Figure 4 It is the example diagram of the dataset in the present invention;

[0028] Figure 5 It is the accuracy curve of the comparative experiment in the present invention;

[0029] Figure 6 It is the accuracy curve of the ablation experiment in the present invention;

[0030] Figure 7 It is the detection effect diagram of the original model in the present invention;

[0031] Figure 8 It is the original label effect diagram of the image in the present invention;

[0032] Figure 9 It is the detection effect diagram of the improved model in the present invention;

[0033] Figure 10 It is the heatmap visualization result of YOLOv8n-BMR in the present invention. DETAILED DESCRIPTION OF THE INVENTION

[0034] The intelligent PCB defect detection system based on YOLOv8n-BMR includes:

[0035] It includes the following steps: constructing a YOLOv8n-BMR model, which includes a bilayer routing attention mechanism module (BRA) and a multi-scale feature fusion module (MSFF);

[0036] introducing Ratio-IOU Loss to optimize the model;

[0037] using the constructed dataset to train the model; applying the trained model to PCB defect detection.

[0038] This system combines a bilayer routing attention mechanism module (BRA) and a multi-scale feature fusion module (MSFF). In addition, this system also introduces Ratio-IOU Loss, where the scale factor ratio is used to adjust the size of the auxiliary bounding box. In this system, BRA filters out most irrelevant key-value pairs at a rough regional level and only retains a small part of the routing area, so as to retain more fine-grained information during feature extraction. In this way, the network model can obtain rich small object features in small-size defect detection tasks with fewer parameters and improve the detection effect. After being processed by BRA, the features will be sent to the MSFF module for multi-scale feature fusion to integrate feature information from different scales and levels. The MSFF module aims to optimize the integration method of these features, thereby improving the model's ability to understand complex patterns and prediction accuracy. Experiments show that this system has achieved SOTA results on the PKU-Market-PCB dataset and has good practicality and universality.

[0039] The backbone network consists of three parts: a convolutional layer (Conv), C2f (CSPDarknet53 to 2-Stage FPN), and SPP F (spatial pyramid pooling fast). Conv extracts features from the image through convolutional operations to capture different scales and semantic information of the image. C2f refers to the design idea of YOLOv7 ELAN (efficient layer attention network) to layer the features, obtaining richer gradient flow information while ensuring light weight. SPPF connects different scales on the same feature map together to achieve the fusion of local features and global features.

[0040] The Neck part combines the feature pyramid network (FPN) with the path aggregation network. FPN transmits deep semantic features to the shallow layer to enhance semantic expression at multiple scales; PAN transmits shallow localization information to the deep layer to enhance localization ability at multiple scales.

[0041] The Head adopts a decoupled head structure, separating the regression branch and the prediction branch, which makes the loss function converge faster.

[0042] Although the model has obvious advantages in detecting large targets, the defects on the surface of PCBs in industrial production are mainly small targets. At the same time, detecting PCB defects on mobile devices usually requires a lightweight model to meet the deployment requirements. Therefore, it is necessary to improve the small target detection ability of the model and reduce the weight file under the condition of real-time detection.

[0043] Introduction to the 3YOLOv8n-BMR Model

[0044] Facing the complex shapes and small sizes of defects in PCB defect detection, it is difficult to accurately capture them, resulting in low recognition and detection rates and accuracy of the original YOLOv8n, and problems of missed detection and false detection. The system makes the following improvements to YOLOv8n:

[0045] To improve the detection accuracy of small-sized defects with fewer network model parameters, a bilayer routing attention mechanism BRA is introduced. By retaining fine-level features, it ensures that more local detailed information can be retained when extracting slender defects. The BRA mechanism filters out most of the irrelevant information at the rough regional level and only retains the regions related to the defect targets. This enables the network to focus more on the regions containing slender targets or key defects, rather than consuming computing resources on the irrelevant background parts. BRA also combines a local context enhancement term, so that when extracting key features, it can not only retain the detailed information of the target region, but also use the context information to enhance the understanding of local features.

[0046] To further improve the detection performance, the system designs a multi-scale feature fusion module (MSFF). The features processed by BRA are sent into the multi-scale feature fusion module (MSFF) for effective fusion. MSFF can integrate features from different scales, not only enhancing the detection accuracy of the model for small target defects, but also improving the richness and robustness of the overall feature expression.

[0047] Ratio-IOU Loss is designed as the loss function of the model, which improves the overall model efficiency and effectively alleviates the problems of extended training time and slowed convergence speed that may be caused by the introduction of MSFF.

[0048] 3.1 Bilayer Routing Attention Mechanism BRA

[0049] Regarding the problem of small object detection in PCB defect detection, a Bi-level Rounding Attention (BRA) is introduced to retain fine-grained features in feature extraction, improving the detection accuracy of small-size defects with fewer network model parameters. This is a dynamic query-aware sparse attention mechanism that combines coarse-grained key region screening and fine-grained feature refinement, not only enhancing the feature extraction ability but also enabling more flexible computational allocation and content awareness. The structural schematic diagram of BRA is as shown in Figure 2 as follows.

[0050] As can be seen from the figure, the height of the input feature map is H, the width is W, and the number of channels is C. The input feature Figure X ∈R H×W×C is divided into S×S different regions, and each region contains feature vectors. These feature vectors are linearly mapped to obtain three tensors, namely The calculation formulas are as follows:

[0051] Q = X r W q , K = X r W k , V = X r W v (1)

[0052] where the weights W q , W k , W v are the projections of the query, key, and value respectively. Then, by constructing a directed graph, the attention relationship between regions is established. The regions Q and K are averaged to obtain the corresponding Q r and K r . Next, the affinity between regions is calculated through the matrix multiplication between Q r and the transpose of K r to obtain the adjacency matrix A r of the affinity from region to region. The calculation formula is as follows:

[0053] A r = Q r (K r ) T (2)

[0054] At the coarse-grained level, the least relevant connections in the adjacency matrix A r are filtered out, and only the top k most relevant connections of each region are retained to obtain a routing index matrix I r . The calculation formula is as follows:

[0055] I r = topkIndex(A r) (3)

[0056] At the fine-grained level, a token-to-token attention mechanism is used. The routing index matrix I is collected r Key tensor K g and value tensor V g , and the calculation formula is as follows:

[0057] K g = gather(K, I r ), V g = gather(V, I r )(4)

[0058] Finally, the collected K g and V g are used with the attention mechanism and combined with the query tensor Q to obtain the output tensor O. The calculation formula is as follows:

[0059] O = Attention(Q, K g , V g ) + LCE(V)(5)

[0060] Among them, in order to enhance the context, a local context enhancement (LCE) function is adopted, and the depth convolution with a kernel size of 5 is set.

[0061] The core idea of the bilayer routing attention mechanism (BRA) is to optimize the content selection in the feature map by establishing a directed graph routing. Incorporating the bilayer routing attention mechanism into the end of the backbone network allows the model to more autonomously decide which regions to allocate computing resources, thereby better capturing the key information in the image, enhancing the degree of context association, improving the feature extraction ability of the model, reducing the computational complexity and memory requirements, and providing more convenience for the deployment of the model.

[0062] 3.2 Multi-scale Feature Fusion Module MSFF

[0063] After being processed by the BRA module, feature maps with rich information are obtained. These feature maps contain local and global information at different levels and are crucial for subsequent processing. However, in order to further enhance the expressive power of the features and improve the robustness of the model, these multi-scale features need to be effectively fused. Therefore, the MSFF module is designed in this system, and its structure is as Figure 3 shown.

[0064] First, for the input feature X with a size of C×H×W, where C is the number of channels, and H and W are the height and width respectively. Then, after convolution operations with different-sized convolution kernels, features of different scales are obtained. Secondly, each scale of features will be processed by a group of convolution blocks. Among them, a group of convolution blocks includes C 2g grouped convolutional kernels, each kernel processes C / g channels, where g is the number of groups. After each convolutional layer, a ReLU activation function is applied. Then, for the features processed by grouped convolution, they will go through a convolution of C channels and are concatenated into one feature. The calculation process is as follows:

[0065] F conv = ReLU(CConv(GConv(F, C 2 , g))) (6)

[0066] where GConv(F, C 2 , g) represents convolving the feature F using C 2 grouped convolutional kernels, each kernel processes C / g channels, and CConv(F) represents performing channel convolution on the output of each grouped convolutional kernel. Finally, the features of each scale go through an Element-wise operation to obtain the fused output features.

[0067] Through the BRA module, the model can already capture the feature information in the image. The MSFF module, through the grouped convolutional layer and channel convolutional layer in the convolutional block, enables the model to learn features of different scales. Finally, through the element-wise multiplication operation, the model can adaptively adjust the weights of features of different scales, enabling the model to dynamically adjust the attention to features of different scales according to the task requirements, and further enhancing the expression ability of these information through feature fusion, making it more suitable for dealing with small targets and multi-scale variations in PCB defects.

[0068] 3.3 Ratio-IOU Loss Function

[0069] In the process of optimizing the model performance, this system introduces Ratio-IOU Loss as the loss function in the algorithm model. This improvement aims to enhance the overall model efficiency by adopting a more accurate and rapidly converging loss function, and effectively alleviate the problems of extended training time and slowed convergence speed that may be caused by the introduction of MSFF. Although CIoU_Loss has comprehensively considered the overlap degree of bounding boxes, the distance between center points, and the aspect ratio matching degree, it has limitations in dealing with the real differences between the width-height dimension and its confidence, which to a certain extent restricts the optimization potential and accuracy improvement of the model.

[0070] To overcome the above problems and further improve the accuracy of the PCB defect detection task, this system proposes Ratio-IOU Loss. This loss function particularly focuses on the internal intersection ratio between the predicted box and the ground truth box, thus more directly reflecting the coverage of the predicted box on the internal structure of the target, which helps to improve the localization accuracy of the model for the internal details of the target. The calculation process of Ratio-IOU loss is as follows:

[0071] (1) First, calculate the bounding box coordinates

[0072] a) Coordinate calculation of the ground truth box

[0073]

[0074] b) Coordinate calculation of the predicted box

[0075]

[0076] (2) Calculation of the intersection area

[0077]

[0078] (3) Calculation of the union area

[0079] union=(w gt ·h gt )+(w·h)-inter (10)

[0080] (4) Ratio-IOU calculation

[0081]

[0082] (5) Loss function

[0083] Loss Ratio-IOU =-log(Ratio-IOU) (12)

[0084] By more accurately reflecting the coverage of the internal structure, Ratio-IOU Loss can guide the model to converge to the optimal solution faster. For smaller objects, even a slight deviation of the predicted box may lead to a large decrease in IOU, while Ratio-IOU can better capture these subtle changes. In summary, Ratio-IOU Loss provides an effective means to optimize the positioning accuracy of the PCB defect detection model for the internal structure, while improving the convergence speed and overall performance of the model.

[0085] 4 Experimental part

[0086] 4.1 Experimental environment

[0087] This experiment was conducted under the ubuntu20.0.4 operating system, with 40GB of memory, equipped with a Tesla V100S GPU and an Intel Xeon Platinum 8255C CPU, using PyTorch2.0.0, Python3.8, and Cuda11.8.

[0088] 4.2 Dataset

[0089] The experiments of this system use the PKU-Market-PCB dataset from Peking University. After expansion, there are a total of 3,465 PCB defect images. The types of defects include six types of PCB defects: missing hole (Mh), mouse bite (Mb), open circuit (Oc), short circuit (Sh), burr (Sp), and miscellaneous copper (Sc). The training set, validation set, and test set are divided in the ratio of 8:1:1. The distribution of various defects in the expanded dataset is shown in Table 1. The defect pictures of the expanded new dataset are as shown in Figure 4 shown, which are six types: Mh, Mb, Oc, Sh, Sp, and Sc, marked as 0, 1, 2, 3, 4, and 5 in the figure respectively.

[0090]

[0091]

[0092] 4.3 Evaluation Metrics

[0093] Considering the requirements for the accuracy of steel defect detection in practical applications, this system uses Precision, Recall, and mean Average Precision (mAP) as evaluation metrics. Precision refers to the proportion of correctly predicted results among all results predicted as positive samples. Precision is calculated using formula (13):

[0094]

[0095] Recall is the proportion of positive samples correctly predicted as positive samples among all positive samples of the model. Recall is calculated using formula (14):

[0096]

[0097] Among them, TP represents the positive samples predicted as positive classes by the model, FP represents the negative samples predicted as positive classes by the model, and FN represents the positive samples predicted as negative classes by the model.

[0098] AP is the area enclosed by the Precision-Recall curve and the coordinate axes, representing the average precision at different recall rates. AP is calculated using formula (15):

[0099]

[0100] mAP (mean Average Precision) is a comprehensive metric used to evaluate the performance of object detection models across multiple classes. Calculate the average precision (AP) for each class and then take the mean to measure the performance of the model. mAP is calculated using formula (16):

[0101]

[0102] Among them, C represents the number of categories in the dataset. The higher the mAP value, the better the performance of the model. mAP0.5:0.95 represents the average mAP calculated at multiple IoU thresholds (ranging from 0.5 to 0.95 with a step of 0.05). This means that the performance of the model at different IoU thresholds will be considered, providing a more comprehensive evaluation.

[0103] 4.4 Experimental Section

[0104] 4.4.1 Comparative Experiment

[0105] To verify the superiority of the model proposed in this system, comparative experiments were conducted by comparing it with several mainstream models. The experimental results are shown in Table 2.

[0106]

[0107] In the comparative experiment, the YOLOv8n - BMR model proposed in this system demonstrated good performance, especially achieving a significant advantage in the mAP@0.5 metric. Specifically, under the mAP@0.5 metric, YOLOv8n - BMR reached an accuracy of 97.28%, far exceeding other mainstream models such as YOLOv5 (91.81%), YOLOv7 (91.05%), YOLOv8 (92.79%), and YOLOv11 (94.02%). This result indicates that YOLOv8n - BMR has higher confidence and accuracy in detecting targets, and can more effectively identify more true positive samples at a lower intersection - over - union threshold. This means that for most application scenarios, especially those tasks with higher requirements for detection recall rate, YOLOv8n - BMR can provide more reliable detection results. Looking at the more stringent mAP@0.5:0.95 metric, YOLOv8n - BMR also performed excellently, reaching 68.14%, exceeding all comparison models. Compared with YOLOv5 (61.45%), YOLOv7 (63.53%), YOLOv8 (63.41%), and YOLOv11 (60.16%), YOLOv8n - BMR not only maintained excellent detection accuracy in the high intersection - over - union threshold range but also demonstrated stronger robustness and generalization ability. mAP@0.5:0.95 comprehensively evaluates the performance of the model at different intersection - over - union ratios, so this metric can better reflect the overall performance of the model. The excellent performance of YOLOv8n - BMR in this metric proves its advantages in dealing with complex scenarios and multi - scale object detection tasks, and can provide users with more stable and high - quality detection results. In addition, this experiment also plotted the accuracy comparison curve during the training process, as Figure 4 shown.

[0108] It can be observed that after 25 epochs, the performance of the YOLOv8n-BMR model has been leading, indicating that the learning effect of the system model is very good. By extracting and fusing multi-level and multi-scale features, the improvement of the model performance is very obvious. It is worth noting that in the experiment, an early stopping strategy was adopted. If the model did not improve after more than 50 epochs, it would stop running.

[0109] 4.4.2 Ablation Experiment

[0110] To verify the effectiveness of various modules proposed in this system, ablation experiments were designed for the BRA module, MSFF module, and Ratio-IOU loss function, as shown in Table 3.

[0111]

[0112] The results of the ablation experiment show that each individually introduced module significantly improved the basic performance of YOLOv8. First, YOLOv8-Ratio-IOU with only the Ratio-IOU loss function introduced reached 95.29% and 66.27% in mAP@0.5 and mAP@0.5:0.95 respectively, showing a significant improvement compared to the basic YOLOv8 (92.79% and 63.41%). This indicates that the Ratio-IOU loss function is effective in optimizing the localization accuracy of the target bounding box. Second, YOLOv8-BRA with the BRA module added further increased mAP@0.5 to 96.66%. Although mAP@0.5:0.95 slightly decreased to 63.27%, it still maintained a high level of detection performance, proving the effectiveness of the BRA module in capturing multi-scale information. Finally, YOLOv8-MSFF with the MSFF module added also achieved good results, with mAP@0.5 being 96.91% and mAP@0.5:0.95 being 63.61%, indicating the advantage of the MSFF module in feature fusion. These results clearly demonstrate the positive contributions of each module to the model performance. In addition, in this experiment, a precision comparison curve during the training process was also plotted, as Figure 5 shown.

[0113] By observing the curve, it is found that after 25 epochs of training, the differences between the models begin to become larger. The overall trend shows that after each module is added to the YOLOv8 model, certain improvements in the performance are achieved, indicating that each module has a certain improvement on the model performance.

[0114] 4.4.3 Qualitative Analysis

[0115] To verify that the YOLOv8n-BMR model proposed in this system has higher detection accuracy, several detection effect diagrams were selected from the test dataset for display, asFigure 7 As shown. Comparative analysis shows that the improved YOLOv8n-BMR model can not only successfully identify defects that the original model failed to capture, effectively reducing the missed detection phenomenon, but also significantly improve the detection ability for small targets. This proves that through the improvement of this system, various types of defects can be identified more comprehensively and accurately, thus greatly improving the overall detection performance.

[0116] To illustrate that the YOLOv8n-BMR model proposed by this system has higher precision, some pictures in the test set were visualized as heatmaps in this experiment, as Figure 7 shown.

[0117] By observing the heatmap, it can be found that YOLOv8n-BMR can focus on key details such as the texture of the PCB defect part. As shown in the figure, on different types of defects (such as hole missing, short circuit, and mouse bite), YOLOv8n-BMR can accurately identify and locate these subtle abnormal areas. For example, when detecting a missing hole (bottom right), the model can not only accurately capture the position of the missing hole, but also clearly show the texture changes in the surrounding area, thus improving the detection accuracy. When dealing with complex defects such as short circuits (top right) and mouse bites (bottom left), YOLOv8n-BMR also shows excellent capabilities and can accurately distinguish the defect area in a complex background. These results indicate that YOLOv8n-BMR not only has high-precision detection capabilities, but also can effectively capture and utilize subtle features in the image, thus significantly improving the overall detection performance.

[0118] 5. Conclusion

[0119] The YOLOv8n-BMR model proposed by this system has shown significant improvements in PCB defect detection. Through BRA, fine-grained retention of features is ensured, ensuring that more local detail information can be retained when extracting slender defects. Subsequently, these features are integrated with multi-scale information via the MSFF module, optimizing the fusion of global and local features and improving the detection accuracy for small targets and complex patterns. This model also introduces Ratio-IOU Loss, which adjusts the size of the bounding box using a scale factor, improving the detection accuracy and robustness. Experiments show that this model achieves a high precision of 97.28% on the PKU-Market-PCB dataset, significantly reducing missed detections and improving the recognition effect of small target defects.

[0120] The above is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention, according to the technical solution and inventive concept of the present invention, makes equivalent substitutions or changes, and all should be covered within the protection scope of the present invention.

Claims

1. PCB defect intelligent detection system based on YOLOv8n-BMR, characterized by: The following steps are involved: Construct a YOLOv8n-BMR model, which includes a two-layer routing attention mechanism module (BRA) and a multi-scale feature fusion module (MSFF); Introduce Ratio-IOU Loss to optimize the model; The constructed dataset is used to train the model; the trained model is applied to PCB defect detection.

2. The PCB defect intelligent detection system based on YOLOv8n-BMR according to claim 1, characterized in that: The dual-layer routing attention mechanism module (BRA) improves the detection accuracy of small-sized defects by retaining fine-grained information during feature extraction.

3. The PCB defect intelligent detection system based on YOLOv8n-BMR according to claim 1, characterized in that: The multi-scale feature fusion module (MSFF) enhances the model's ability to understand complex scenes by integrating feature information of different scales.

4. The PCB defect intelligent detection system based on YOLOv8n-BMR according to claim 1, characterized in that: The Ratio-IOU Loss adjusts the size of the auxiliary bounding box, optimizes the positioning of the bounding box, and improves the detection accuracy.

5. The PCB defect intelligent detection system based on YOLOv8n-BMR according to claim 1, characterized in that: It includes a data preprocessing module, a YOLOv8n-BMR model module and a result output module; the data preprocessing module is used to preprocess the input PCB image; the YOLOv8n-BMR model module is used to perform defect detection on the preprocessed image; and the result output module is used to output the detection result.

6. The PCB defect intelligent detection system based on YOLOv8n-BMR according to claim 5 is characterized in that: The YOLOv8n-BMR model module includes a two-layer routing attention mechanism module (BRA) and a multi-scale feature fusion module (MSFF).

7. The PCB defect intelligent detection system based on YOLOv8n-BMR according to claim 5, characterized in that: A training module is also included for training the YOLOv8n-BMR model using the constructed dataset.

8. The PCB defect intelligent detection system based on YOLOv8n-BMR according to claim 5, characterized in that: The result output module also includes a visualization module, which is used to display the detection results to the user in a visual manner.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the YOLOv8n-BMR-based PCB defect intelligent detection system described in any one of claims 1 to 8 is implemented.

10. An electronic device comprising a processor and a storage medium, characterized in that: A computer program is stored on the storage medium, and when the program is executed by the processor, the YOLOv8n-BMR-based PCB defect intelligent detection system according to any one of claims 1 to 8 is implemented.