A semi-supervised PCB surface defect detection method and system based on dual-granularity pseudo-label calibration

CN122736989APending Publication Date: 2026-09-11SHANDONG JIAOTONG UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610838964.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-11
Publication Date
2026-09-11

AI Technical Summary

Technical Problem

[0005]为了改善现有半监督PCB表面缺陷检测中伪标签筛选不够精细的问题,本申请提供一种基于双粒度伪标签校准的半监督PCB表面缺陷检测方法及系统

Benefits of technology

本申请的基于双粒度伪标签校准的半监督PCB表面缺陷检测方法,能够在不改变检测器网络结构和推理流程的前提下,提高未标注PCB图像伪标签的筛选质量,使学生检测器获得更可靠的训练监督信息。相比固定置信度阈值方法,本申请同时考虑缺陷类别差异和缺陷尺度差异,能够更准确地适应PCB缺陷伪标签置信度分布不均的问题;相比单纯类别阈值方法,本发明进一步引入尺度区间统计和小尺度下界松弛机制,能够减少小尺度缺陷伪标签因置信度偏低而被误删的情况。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122736989A_ABST
    Figure CN122736989A_ABST
Patent Text Reader

Abstract

This application relates to the technical field of PCB inspection, and more particularly to a semi-supervised method and system for PCB surface defect detection based on dual-granularity pseudo-label calibration. The method and system are based on a teacher-student training model, using a small number of labeled PCB defect images to train a teacher detector; the trained teacher detector performs weak view prediction and strong view prediction on unlabeled PCB images, generating two sets of candidate pseudo-labels respectively; the two sets of candidate pseudo-labels are fused across views and input into a dual-granularity pseudo-label calibration module for filtering, obtaining calibrated pseudo-labels; the original labeled images and the calibrated pseudo-label images together form a training set for training a student detector, which then outputs the PCB surface defect detection results. This application can improve the filtering quality of pseudo-labels for unlabeled PCB images, enabling the student detector to obtain more reliable training supervision information and more accurately adapt to the problem of uneven confidence distribution of PCB defect pseudo-labels.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of PCB inspection, and in particular to a semi-supervised PCB surface defect detection method and system based on dual-granularity pseudo-label calibration. Background Technology

[0002] Currently, existing PCB surface defect detection mainly employs automated optical inspection (AOI) and deep learning-based target detection methods. Traditional AOI methods often rely on template matching, image differencing, threshold segmentation, and edge detection to identify defects, but they are sensitive to changes in lighting, image registration errors, and complex circuit backgrounds, resulting in limited detection stability.

[0003] In recent years, deep learning detection models such as YOLO, Faster R-CNN, SSD, and RT-DETR have been widely used for PCB defect detection, automatically extracting defect features and completing classification and localization. However, these supervised methods typically require a large number of manually labeled samples, while PCB defects are often small in size, have weak boundaries, and complex shapes, resulting in high labeling costs. To reduce the labeling requirements, semi-supervised object detection methods generate pseudo-labels for unlabeled images using a teacher model, and then use these pseudo-labels to train a student model. The selection of pseudo-labels usually relies on a fixed confidence threshold or a category threshold.

[0004] The effectiveness of existing semi-supervised PCB surface defect detection methods is highly dependent on the quality of pseudo-labels. Fixed confidence thresholds are insufficient to accommodate the confidence differences between different defect categories. While category thresholds consider category differences, they ignore the confidence distribution differences of defects at different scales within the same category. PCB defects are typically characterized by small scale, weak significance, and ambiguous boundaries. Small defects generally have low prediction confidence and are easily mistakenly deleted by existing screening strategies. This results in student models lacking effective supervision information, which in turn affects the recall rate and detection stability of small-scale defects. Summary of the Invention

[0005] To address the issue of insufficient precision in pseudo-label screening during existing semi-supervised PCB surface defect detection, this application provides a semi-supervised PCB surface defect detection method and system based on dual-granularity pseudo-label calibration.

[0006] This application provides a semi-supervised PCB surface defect detection method based on dual-granularity pseudo-label calibration, which adopts the following technical solution: A semi-supervised PCB surface defect detection method based on dual-granularity pseudo-label calibration, the method being based on a teacher-student training model, includes the following steps: S1. First, train the teacher detector using a small number of labeled PCB defect images; S2. Using the trained teacher detector, perform weak view prediction and strong view prediction on the unlabeled PCB image, and generate two sets of candidate pseudo-labels respectively. S3. Perform cross-view fusion on the two groups of candidate pseudo-labels and input them into the dual-granularity pseudo-label calibration module for filtering to obtain the calibrated pseudo-labels; S4. The original labeled image and the calibrated pseudo-label image are combined to form a training set, which is used to train the student detector, and the student detector completes the PCB surface defect detection output.

[0007] Preferably, in step S1, The set of labeled PCB images is as follows: ; The collection of unlabeled PCB images is as follows: ; in, Indicates the first Zhang has already labeled the PCB image. This indicates the corresponding manually labeled information. Indicates the first Zhang's unlabeled PCB image and These represent the number of labeled images and the number of unlabeled images, respectively. The teacher detector is recorded as: .

[0008] Preferably, in step S2, for any unlabeled image We construct weak view prediction and strong view prediction respectively, and obtain two sets of candidate pseudo-labels: ; ; in, This indicates weak view processing. This indicates strong view processing. This represents the set of candidate pseudo-labels for weak views. This represents the set of candidate pseudo-labels for a strong view. Each pseudo-tag can be represented as: ; Where b represents the defect bounding box and c represents the defect category. Let represent the prediction confidence level, and satisfy: .

[0009] Preferably, in step S3, the weak view pseudo-labels and strong view pseudo-labels are subjected to class non-maximum suppression respectively, and cross-view fusion is performed to obtain a fused pseudo-label set: ; Merging pseudo-tag sets After filtering by the dual-granularity pseudo-label calibration module, the following calibration pseudo-label set is obtained: ; The unlabeled training subset consisting of calibration pseudo-labels is: in, This indicates the set of calibration pseudo-labels. The pseudo-annotation information corresponding to the j-th unannotated PCB image obtained.

[0010] Preferably, in step S4, the training set of the student detector is: ; The student detector is denoted as: ; Student detector based on After training is completed, defect category prediction and bounding box regression are performed on the PCB image to be inspected, and the PCB surface defect detection results are output.

[0011] Preferably, the fused pseudo-label set is subjected to category-scale joint screening, and the steps are as follows: Step 1: Calculate the normalized bounding box area, assuming any pseudo-label. The normalized bounding box width is The normalized bounding box height is Then its normalized area is: ; Step 2: Divide the pseudo-labels into small, medium and large scales based on the normalized area of ​​the pseudo-label bounding box. Step 3: Calculate the confidence distribution under different defect categories and the confidence distribution under different combinations of "defect category - scale interval"; Step 4: Calculate the category-level threshold and the category-scale-level threshold based on the statistical results; when the number of pseudo-labels in a certain category-scale combination is insufficient, use the corresponding category-level threshold as the fallback threshold. Step 5: Obtain the final filtering threshold through a scale-related lower bound relaxation mechanism; Step 6: Filter fake tags based on calibration thresholds.

[0012] Preferably, in step 2, Based on normalized area The pseudo-labels are divided into different scale ranges; When the following conditions are met: ; This pseudo-label belongs to the small-scale pseudo-label category. ; When the following conditions are met: ; This pseudo-label is a mesoscale pseudo-label. ; When the following conditions are met: ; This pseudo-tag is a large-scale pseudo-tag. ; in, This represents the area boundary threshold between small and medium scales. This represents the area boundary threshold between mesoscale and large-scale regions.

[0013] Preferably, in step 3, for defect categories Collect all confidence scores belonging to this category from the merged pseudo-label set to obtain the category-level confidence score set: .

[0014] Preferably, in step 4, Based on category-level confidence sets The category-level thresholds are determined using percentile statistics. ; in, Indicates percentile parameters; For defect categories and scale interval Collect the pseudo-label confidence scores that belong to both the category and the scale interval to obtain the category-scale confidence score set: ; Based on category-scale confidence set Determine the category-scale threshold. When the number of pseudo-labels in the set is not less than the preset minimum number Use the percentile threshold within this category-scale combination: ; When the number of pseudo-labels in the set is less than the preset minimum number When this happens, the corresponding category-level threshold is used as the fallback threshold; .

[0015] Preferably, in step 5, the final filtering threshold is obtained through calibration: ; in, This represents the baseline confidence threshold. This represents the scale-dependent threshold relaxation coefficient. This represents the lower bound coefficient of scale correlation; In step 6, for any fusion pseudo-tag When its confidence level satisfies the following formula, it is retained as a calibration pseudo-label: ; Right now: ; Otherwise, the pseudo-label is filtered out, thus obtaining the calibration pseudo-label set. This is used for subsequent training of the student detector.

[0016] This application also provides a semi-supervised PCB surface defect detection system based on dual-granularity pseudo-label calibration, the technical solution of which is as follows: A semi-supervised PCB surface defect detection system based on dual-granularity pseudo-label calibration, wherein the system adopts the method described in any one of claims 1-10, the system includes a teacher detector, the teacher detector is divided into a weak view prediction branch and a strong view prediction branch, and after the teacher detector is trained on a small number of labeled PCB defect images, it performs weak view prediction and strong view prediction on unlabeled PCB images. The pseudo-tag fusion module is used to fuse pseudo-tags across views; The dual-granularity pseudo-label calibration module is used to perform category-scale joint screening on the fused pseudo-label set; Student detector, used to output PCB surface defect detection results.

[0017] In summary, this application includes at least one of the following beneficial technical effects: This application presents a semi-supervised PCB surface defect detection method based on dual-granularity pseudo-label calibration. This method improves the screening quality of unlabeled PCB image pseudo-labels without altering the detector network structure and inference process, enabling the student detector to obtain more reliable training supervision information. Compared to fixed confidence threshold methods, this application considers both defect category differences and defect scale differences, more accurately adapting to the uneven distribution of confidence in PCB defect pseudo-labels. Compared to simple category threshold methods, this invention further introduces scale interval statistics and a small-scale lower bound relaxation mechanism, reducing the likelihood of small-scale defect pseudo-labels being mistakenly deleted due to low confidence. Attached Figure Description

[0018] Figure 1 This is a flowchart of a semi-supervised PCB surface defect detection method based on dual-granularity pseudo-label calibration in an embodiment of this application.

[0019] Figure 2 This is a flowchart of the dual-granularity pseudo-label calibration module in the embodiments of this application.

[0020] Figure 3 This is a statistical comparison chart of pseudo-notes at different scale intervals in the embodiments of this application. Detailed Implementation

[0021] The following is in conjunction with the appendix Figure 1-3 This application will be described in further detail.

[0022] This application discloses a semi-supervised PCB surface defect detection method based on dual-granularity pseudo-label calibration, referring to... Figure 1 and Figure 2 The method includes the following steps: S1. First, train the teacher detector using a small number of labeled PCB defect images; set up: The set of labeled PCB images is as follows: ; The collection of unlabeled PCB images is as follows: ; in, Indicates the first Zhang has already labeled the PCB image. This indicates the corresponding manually labeled information. Indicates the first Zhang's unlabeled PCB image and These represent the number of labeled images and the number of unlabeled images, respectively. The teacher detector is recorded as: ; S2. Using the trained teacher detector, perform weak view prediction and strong view prediction on the unlabeled PCB image, and generate two sets of candidate pseudo-labels respectively. Specifically, for any unlabeled image We construct weak view prediction and strong view prediction respectively, and obtain two sets of candidate pseudo-labels: ; ; in, This indicates weak view processing. This indicates strong view processing. This represents the set of candidate pseudo-labels for weak views. This represents the set of candidate pseudo-labels for a strong view. Each pseudo-tag can be represented as: ; Where b represents the defect bounding box and c represents the defect category. Let represent the prediction confidence level, and satisfy: ; S3. Perform cross-view fusion on the two groups of candidate pseudo-labels and input them into the dual-granularity pseudo-label calibration module for filtering to obtain the calibrated pseudo-labels; Specifically, class nonmaximum suppression is applied to both weak view pseudo-labels and strong view pseudo-labels, and cross-view fusion is performed to obtain a fused pseudo-label set: ; Merging pseudo-tag sets After filtering by the dual-granularity pseudo-label calibration module, the following calibration pseudo-label set is obtained: ; The unlabeled training subset consisting of calibration pseudo-labels is: in, This indicates the set of calibration pseudo-labels. The pseudo-annotation information corresponding to the j-th unannotated PCB image obtained S4. The original labeled images and the calibrated pseudo-label images are combined to form the training set. The training set for the student detector is as follows: ; The student detector is denoted as: ; Student detector based on After training is completed, defect category prediction and bounding box regression are performed on the PCB image to be inspected, and the PCB surface defect detection results are output.

[0023] The category-scale joint screening of the fused pseudo-label set in step S3 is performed as follows: Step 1: Calculate the normalized bounding box area, assuming any pseudo-label. The normalized bounding box width is The normalized bounding box height is Then its normalized area is: ; Step 2: Divide the pseudo-labels into small, medium and large scales based on the normalized area of ​​the pseudo-label bounding box. Specifically, based on the normalized area The pseudo-labels are divided into different scale ranges; When the following conditions are met: ; This pseudo-label belongs to the small-scale pseudo-label category. ; When the following conditions are met: ; This pseudo-label is a mesoscale pseudo-label. ; When the following conditions are met: ; This pseudo-tag is a large-scale pseudo-tag. ; in, This represents the area boundary threshold between small and medium scales. This represents the area boundary threshold between mesoscale and large-scale regions. Step 3: Calculate the confidence distribution under different defect categories and the confidence distribution under different combinations of "defect category - scale interval"; Specifically, regarding defect categories Collect all confidence scores belonging to this category from the merged pseudo-label set to obtain the category-level confidence score set: ; Step 4: Calculate the category-level threshold and the category-scale-level threshold based on the statistical results; when the number of pseudo-labels in a certain category-scale combination is insufficient, use the corresponding category-level threshold as the fallback threshold. Specifically, based on the category-level confidence set The category-level thresholds are determined using percentile statistics. ; in, Indicates percentile parameters; For defect categories and scale interval Collect the pseudo-label confidence scores that belong to both the category and the scale interval to obtain the category-scale confidence score set: ; Based on category-scale confidence set Determine the category-scale threshold. When the number of pseudo-labels in the set is not less than the preset minimum number Use the percentile threshold within this category-scale combination: ; When the number of pseudo-labels in the set is less than the preset minimum number When this happens, the corresponding category-level threshold is used as the fallback threshold; Step 5: Obtain the final filtering threshold through a scale-dependent lower bound relaxation mechanism. ; in, This represents the baseline confidence threshold. This represents the scale-dependent threshold relaxation coefficient. This represents the lower bound coefficient of scale correlation; Step 6: Filter fake tags based on calibration thresholds. Specifically, for any fusion pseudo-tag When its confidence level satisfies the following formula, it is retained as a calibration pseudo-label: ; Right now: ; Otherwise, the pseudo-label is filtered out, thus obtaining the calibration pseudo-label set. This is used for subsequent training of the student detector.

[0024] Further statistical analysis was conducted on the distribution of fused pseudo-labels across different scale ranges, as well as the number and percentage of pseudo-labels retained in each scale range after different pseudo-label screening strategies.

[0025] Referring to Figure 3, it is found that the PCB defect pseudo-labels are mainly concentrated in the small-scale range. This also shows that the present invention can retain more small-scale defect pseudo-labels with training value by using the lower bound relaxation mechanism to ensure the reliability of screening. Let the number of original fused pseudo-labels in the scale interval s be: ; The number of pseudo-tags retained after dual-granularity pseudo-tag calibration is: ; The pseudo-label retention rate within this scale range is: ; in, Can be taken , or By comparing different scale intervals , and It can be seen that this application does not simply increase the number of pseudo-labels, but rather implements differentiated screening of pseudo-labels at different scales based on dual-granularity statistics of category and scale.

[0026] This application also provides a semi-supervised PCB surface defect detection system based on dual-granularity pseudo-label calibration, the technical solution of which is as follows: A semi-supervised PCB surface defect detection system based on dual-granularity pseudo-label calibration. The system adopts the above-mentioned detection method and includes a teacher detector, which is divided into a weak view prediction branch and a strong view prediction branch. After the teacher detector is trained on a small number of labeled PCB defect images, it performs weak view prediction and strong view prediction on unlabeled PCB images. The pseudo-tag fusion module is used to fuse pseudo-tags across views; The dual-granularity pseudo-label calibration module is used to perform category-scale joint screening on the fused pseudo-label set; Student detector, used to output PCB surface defect detection results.

[0027] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.

Claims

1. A semi-supervised PCB surface defect detection method based on dual-granularity pseudo-label calibration, characterized in that, The method is based on a teacher-student training model, and the steps are as follows: S1. First, train the teacher detector using a small number of labeled PCB defect images; S2. Using the trained teacher detector, perform weak view prediction and strong view prediction on the unlabeled PCB image, and generate two sets of candidate pseudo-labels respectively. S3. Perform cross-view fusion on the two groups of candidate pseudo-labels and input them into the dual-granularity pseudo-label calibration module for filtering to obtain the calibrated pseudo-labels; S4. The original labeled image and the calibrated pseudo-label image are combined to form a training set, which is used to train the student detector, and the student detector completes the PCB surface defect detection output.

2. The semi-supervised PCB surface defect detection method based on dual-granularity pseudo-label calibration according to claim 1, characterized in that: In step S1, The set of labeled PCB images is as follows: ; The collection of unlabeled PCB images is as follows: ; in, Indicates the first Zhang has already labeled the PCB image. This indicates the corresponding manually labeled information. Indicates the first Zhang's unlabeled PCB image and These represent the number of labeled images and the number of unlabeled images, respectively. The teacher detector is recorded as: .

3. The semi-supervised PCB surface defect detection method based on dual-granularity pseudo-label calibration according to claim 2, characterized in that: In step S2, for any unlabeled image We construct weak view prediction and strong view prediction respectively, and obtain two sets of candidate pseudo-labels: ; ; in, This indicates weak view processing. This indicates strong view processing. This represents the set of candidate pseudo-labels for weak views. This represents the set of candidate pseudo-labels for a strong view. Each pseudo-tag can be represented as: ; Where b represents the defect bounding box and c represents the defect category. Let represent the prediction confidence level, and satisfy: .

4. The semi-supervised PCB surface defect detection method based on dual-granularity pseudo-label calibration according to claim 3, characterized in that: In step S3, class nonmaximum suppression is applied to both weak view pseudo-labels and strong view pseudo-labels, and cross-view fusion is performed to obtain a fused pseudo-label set: ; Merging pseudo-tag sets After filtering by the dual-granularity pseudo-label calibration module, the following calibration pseudo-label set is obtained: ; The unlabeled training subset consisting of calibration pseudo-labels is: in, This indicates the set of calibration pseudo-labels. The pseudo-annotation information corresponding to the j-th unannotated PCB image obtained.

5. The semi-supervised PCB surface defect detection method based on dual-granularity pseudo-label calibration according to claim 4, characterized in that: In step S4, the training set for the student detector is: ; The student detector is denoted as: ; Student detector based on After training is completed, defect category prediction and bounding box regression are performed on the PCB image to be inspected, and the PCB surface defect detection results are output.

6. The semi-supervised PCB surface defect detection method based on dual-granularity pseudo-label calibration according to claim 4, characterized in that: The following steps are taken to perform joint category-scale filtering on the fused pseudo-label set: Step 1: Calculate the normalized bounding box area, assuming any pseudo-label. The normalized bounding box width is The normalized bounding box height is Then its normalized area is: ; Step 2: Divide the pseudo-labels into small, medium and large scales based on the normalized area of ​​the pseudo-label bounding box. Step 3: Calculate the confidence distribution under different defect categories and the confidence distribution under different combinations of "defect category - scale interval"; Step 4: Calculate the category-level threshold and category-scale-level threshold based on the statistical results; When the number of pseudo-labels in a certain category-scale combination is insufficient, the corresponding category-level threshold is used as the backoff threshold. Step 5: Obtain the final filtering threshold through a scale-related lower bound relaxation mechanism; Step 6: Filter fake tags based on calibration thresholds.

7. A semi-supervised PCB surface defect detection method based on dual-granularity pseudo-label calibration according to claim 6, characterized in that: In step 2, Based on normalized area The pseudo-labels are divided into different scale ranges; When the following conditions are met: ; This pseudo-label belongs to the small-scale pseudo-label category. ; When the following conditions are met: ; This pseudo-label is a mesoscale pseudo-label. ; When the following conditions are met: ; This pseudo-tag is a large-scale pseudo-tag. ; in, This represents the area boundary threshold between small and medium scales. This represents the area boundary threshold between mesoscale and large-scale regions.

8. The semi-supervised PCB surface defect detection method based on dual-granularity pseudo-label calibration according to claim 7, characterized in that: In step 3, for defect categories Collect all confidence scores belonging to this category from the merged pseudo-label set to obtain the category-level confidence score set: 。 9. A semi-supervised PCB surface defect detection method based on dual-granularity pseudo-label calibration according to claim 8, characterized in that: In step 4, Based on category-level confidence sets The category-level thresholds are determined using percentile statistics. ; in, Indicates percentile parameters; For defect categories and scale interval Collect the pseudo-label confidence scores that belong to both the category and the scale interval to obtain the category-scale confidence score set: ; Based on category-scale confidence set Determine the category-scale threshold. When the number of pseudo-labels in the set is not less than the preset minimum number Use the percentile threshold within this category-scale combination: ; When the number of pseudo-labels in the set is less than the preset minimum number When this happens, the corresponding category-level threshold is used as the fallback threshold; 。 10. A semi-supervised PCB surface defect detection method based on dual-granularity pseudo-label calibration according to claim 9, characterized in that: In step 5, the final filtering threshold is obtained through calibration: ; in, This represents the baseline confidence threshold. This represents the scale-dependent threshold relaxation coefficient. This represents the lower bound coefficient of scale correlation; In step 6, for any fusion pseudo-tag When its confidence level satisfies the following formula, it is retained as a calibration pseudo-label: ; Right now: ; Otherwise, the pseudo-label is filtered out, thus obtaining the calibration pseudo-label set. This is used for subsequent training of the student detector.

11. A semi-supervised PCB surface defect detection system based on dual-granularity pseudo-label calibration, characterized in that: The system adopts the method described in any one of claims 1-10. The system includes a teacher detector, which is divided into a weak view prediction branch and a strong view prediction branch. After the teacher detector is trained on a small number of labeled PCB defect images, it performs weak view prediction and strong view prediction on unlabeled PCB images. The pseudo-tag fusion module is used to fuse pseudo-tags across views; The dual-granularity pseudo-label calibration module is used to perform category-scale joint screening on the fused pseudo-label set; Student detector, used to output PCB surface defect detection results.