PCB defect detection method and system based on adaptive multiple submodels

Through the adaptive multi-sub-model system, the priority and feature training of PCB defect detection are dynamically adjusted, which solves the problems of high-frequency defect detection delay and low resource utilization in the existing technology, and realizes efficient and accurate PCB defect detection.

CN120707492AActive Publication Date: 2025-09-26EAST CHINA JIAOTONG UNIVERSITY

Patent Information

Application Number
CN202510784548.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-12
Publication Date
2025-09-26
Estimated Expiration
2045-06-12

AI Technical Summary

Technical Problem

Existing PCB defect detection methods suffer from high-frequency defect detection delays, low resource utilization, poor small sample defect detection results, and threshold judgment reliance on manual experience, which can easily lead to missed detections or false detections.

Method used

An adaptive multi-sub-model system is adopted, which dynamically adjusts the priority order of sub-models through dynamic priority control, feature sharing mechanism and uncertainty assessment, combined with reinforcement agent learning and Bayesian network, uses gradient mask mechanism for specificity training, and improves detection accuracy through confidence screening and cascade control.

Benefits of technology

It achieves rapid response to high-frequency defects, accurate identification of small sample defects and efficient use of computing resources, meeting the high real-time and high robustness quality inspection requirements in industrial scenarios, reducing the computing burden and improving detection efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120707492A_ABST
    Figure CN120707492A_ABST
Patent Text Reader

Abstract

The invention discloses a PCB defect detection method and system based on adaptive multiple submodels, and the method comprises the steps: collecting an image of the surface of a PCB through a high-resolution camera, and carrying out the preprocessing of the image; performing dynamic priority decision through reinforcement learning, and reasonably selecting the priority of the sub-model according to the equipment state and the load of the computing resource; yOLOv8 is adopted as a backbone network, a plurality of sub-models work in parallel, and the sub-models are trained in combination with gradient masks; realizing multi-stage cascade detection by adopting a confidence threshold screening and variance analysis mode, and reversely optimizing parameters of the model according to a batch statistical result; and according to the recall rate and the false detection rate of each detection, optimizing the sub-model through an incremental training mechanism. According to the method, the adaptive multiple sub-models are provided, and through a dynamic priority control and feature sharing mechanism, the high accuracy is ensured, the detection strategy is dynamically adjusted, the calculation burden is reduced, and efficient and accurate PCB defect detection is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical field:

[0001] The present invention belongs to the technical field of PCB defect detection, and in particular relates to a PCB defect detection method and system based on an adaptive multi-submodel. Background technology:

[0002] In the electronics manufacturing industry, quality control of printed circuit boards (PCBs) is crucial for ensuring the performance and stability of electronic products. With advances in technology, traditional manual inspection methods are no longer able to meet the demands for high efficiency and precision. Consequently, automated inspection methods based on computer vision and artificial intelligence have become a hot topic of research. Object detection technology, a key branch of computer vision, has gained increasing attention in recent years for its application in PCB defect detection. By analyzing each pixel in a PCB image, object detection methods can automatically identify and locate defective areas, significantly improving detection efficiency and accuracy. PCB defect detection methods based on object detection offer the advantages of efficiency, automation, and precision, and are gradually replacing traditional inspection methods, becoming an indispensable part of industrial production.

[0003] In traditional object detection methods, models learn to identify various defects and false positives by inputting a large number of different image types. In actual production, different types of defects have different probabilities of occurring, which can lead to lower recognition accuracy for some defect types during training. Infrequent defect types can affect overall recognition accuracy, and some defects may be caused by equipment parameter settings.

[0004] Patent CN202210720601.4 discloses a "PCB defect detection system and PCB defect detection method". This method uses multiple "detection sub-models" to separately identify different defect types on printed circuit boards (PCBs). Each sub-model focuses on learning a specific defect type. The system inputs the target printed circuit board (PCB) image into each sub-model in order of priority. If the current sub-model's predicted probability exceeds a preset threshold, the defect type is determined. Otherwise, the next sub-model is input. The system can also dynamically adjust the sub-model priority based on the actual detection results. Compared with traditional single-model detection methods, this method greatly improves detection efficiency and accuracy, but its use of a fixed priority order may lead to delays in high-frequency defect detection; and independent training of each sub-model can easily lead to feature redundancy, low resource utilization, and poor detection of small sample defect types. In addition, existing threshold judgments rely on manual experience, which can easily lead to missed detections or false detections due to threshold rigidity.

[0005] The information disclosed in this background technology section is only intended to enhance understanding of the overall background of the invention and should not be regarded as an admission or any form of suggestion that the information constitutes the prior art already known to a person skilled in the art. Summary of the invention:

[0006] The purpose of the present invention is to provide a PCB defect detection method and system based on an adaptive multi-submodel. Through the collaborative design of dynamic priority control, feature sharing mechanism and uncertainty assessment, it can achieve rapid response to high-frequency defects, accurate identification of small sample defects and efficient utilization of computing resources, meet the high real-time and high robustness quality inspection requirements in industrial scenarios, and thus overcome the defects in the above-mentioned prior art.

[0007] To achieve the above objectives, the present invention provides a PCB defect detection system based on an adaptive multi-sub-model, comprising an image acquisition module, a dynamic priority control module, a detection execution module, and an evaluation feedback module; the image acquisition module acquires PCB bare board images using a high-resolution camera; the dynamic priority control module dynamically adjusts the priority order of defect detection sub-models through reinforcement agent learning and a Bayesian network; the detection execution module integrates a multi-sub-model network based on YOLOv8, uses a shared backbone network to extract multi-scale features of images, and combines a gradient mask mechanism to perform specific training of the sub-models; the evaluation feedback module implements multi-stage cascade detection using confidence threshold screening and variance analysis, reversely optimizes the parameters of the sub-models based on batch statistical results, and dynamically adjusts the detection strategy.

[0008] A PCB defect detection method based on an adaptive multi-submodel, comprising the following steps:

[0009] S01, the image acquisition module uses a high-resolution industrial camera to collect PCB bare board images and pre-process the images;

[0010] S02. The dynamic priority control module deploys reinforcement agent learning and Bayesian networks to dynamically generate priority queues for detection sub-models based on equipment parameters, defect distribution, and computing resources. Sub-models are determined based on defect types, including leaks, short circuits, rat bites, strays, miscellaneous copper, and open circuits. Reinforcement agent learning collects PCB ID, batch number, mean defect distribution of the last 10 inspections, and GPU utilization data in real time, and encodes the collected data into a 64-dimensional state vector. The sub-model detection order is dynamically adjusted based on the PCB status and defect distribution, and PCB parameters, defect types, and their distribution are monitored in real time. The execution order of the sub-models is automatically adjusted based on the monitoring data to prioritize the detection of areas where defects are more likely to occur. The Bayesian network simultaneously analyzes the conditional probability of equipment process parameters and defect types to verify the rationality of the priority queue. Equipment process parameters include drilling machine power and patch pressure.

[0011] S03 uses the YOLOv8 backbone network based on the CSPDarknet architecture to extract multi-scale features, calculates feature activation values ​​for each sub-model, screens key channels for gradient mask generation, and uses these key channels to train the sub-models. The gradient mask is adjusted based on the importance of each channel to ensure that each sub-model can focus on the most critical features, improving the relevance and efficiency of detection.

[0012] S04. Confidence screening and cascade control are performed on sub-models based on the confidence threshold and historical variance. The confidence of the sub-model output is graded to determine whether to trigger cascade control. This cycle continues until the confidence reaches the target or all sub-models are traversed. If the confidence of the detected defect is low and the historical variance exceeds the preset range, the system automatically initiates the next level of detection to reduce missed detections. The NMS process for overlapping frames is improved, and the IoU value is calculated for all detection frames. For detection frames that do not meet the retention criteria, only the ones with the highest confidence are retained.

[0013] S05. After the detection is completed, the performance indicators of each sub-model are counted in batches and the priority score of the sub-model is calculated; the performance indicators include recall rate and false detection rate; the sub-model priority queue is re-sorted according to the priority score; incremental training is triggered for the sub-model with a recall rate <70% for three consecutive batches; the conditional probability parameters are updated through gradient descent, and the conditional probability of the defect-device parameters is adjusted according to the new data; the reinforcement learning strategy library is updated, and the new state-action-reward data is added to the training set.

[0014] Preferably, in the technical solution, in step S01, the image preprocessing method is to perform illumination correction on the image through a local neighborhood normalization algorithm; assuming that the image size captured by an industrial camera is 1024×1024 pixels, the illumination correction formula is:

[0015]

[0016] Among them, x, y represent the coordinate points, I r (x,y) represents the brightness value of each pixel position (x,y) in the original image, Indicates averaging the brightness of neighboring pixels. represents the sum of the pixel brightness values ​​in a 9×9 neighborhood, and ε is an anti-zero constant.

[0017] Preferably, in the technical solution, in step S02, the reinforcement agent learning includes constructing a state space and making decisions, and the state space is defined as:

[0018] s t =[E ID ,B,D avg ,G]∈R 64 (2),

[0019] Among them, E ID It is the 8-dimensional simplified code of the device ID, used to identify the device; B is the batch number, D avg is the mean of the defect distribution of the last 10 inspections; G is the normalized GPU utilization, with low = 0, medium = 1, and high = 2;

[0020] Construct the state space to encode the collected data into a 64-dimensional state vector, and then convert the 64-dimensional state vector s t As the input of decision generation, decision generation is inferred and output by the double-delayed deep deterministic policy gradient TD3 algorithm. The decision generation output includes the sub-model priority queue 6-dimensional vector π∈R 6 , represents the calling order of the six types of defect models and the confidence threshold adjustment Δτ∈[-0.2,+0.2];

[0021] Decision generation is dynamically adjusted by the following reward function r:

[0022]

[0023] Among them, R t is the true positive rate of the current batch, with a weight of 3, It is the penalty term when the GPU load is high;

[0024] The obtained sub-model priority queue 6-dimensional vector π∈R 6 , real-time acquisition of drilling machine power and patch pressure, verified by Bayesian network, and queued 6-dimensional vector π∈R according to the sub-model priority 6 Generate the final priority queue and send it to the detection execution module.

[0025] Preferably, in the technical solution, in step S03, for each sub-model, the contribution of the feature channel is calculated using the Grad-CAM algorithm, and the key channels with contribution ≥ activation threshold are retained for gradient backpropagation, while the remaining channels are frozen and updated:

[0026]

[0027] Among them, C kc is the activation value of channel c to defect k, that is, the feature channel contribution calculated by the Grad-CAM algorithm, and θ is the activation threshold;

[0028] θ is dynamically adjusted based on GPU utilization:

[0029]

[0030] Preferably, in the technical solution, in step S04, the cascade control step includes: according to the priority queue obtained in step S02, the short-circuit defect detection sub-model is preferentially called, the short-circuit defect detection sub-model performs reasoning on the input sub-graph, and outputs the confidence p of the short-circuit defect and the coordinates of the positioning frame; the confidence p is graded and directly output when the confidence is high, variance analysis is triggered when the confidence is medium, and subsequent detection is skipped when the confidence is low; when the variance analysis is triggered, a sequence of nearly ten short-circuit defect confidences {p1, p2, ..., p 10}, calculate the historical variance:

[0031]

[0032] Among them, p k,i is the confidence level of defect type k in the i-th inspection, p k,j is the confidence level of defect type k in the jth inspection, when When it is determined to be in a high variance state, the next level of detection is triggered;

[0033] After triggering the next level of detection, the rat bite sub-model is called to output the confidence level p of the rat bite defect. The confidence level p is graded and judged. When the confidence level is high, it is directly output. When the confidence level is medium, variance analysis is triggered. When the confidence level is low, subsequent detection is skipped. If the variance analysis shows a high variance state, the next level sub-model is called again until the confidence level meets the standard or all sub-models are traversed.

[0034] Improve NMS to handle overlapping frames, and keep the following rules:

[0035]

[0036] For detection boxes that do not meet the retention conditions, only the ones with the highest confidence are retained.

[0037] Preferably, in the technical solution, in step S05, according to the recall rate R k and the false detection rate F k , update the detection sub-model priority according to the following formula:

[0038]

[0039] Bayesian network parameter update, update the conditional probability parameter ω through gradient descent,

[0040]

[0041] Among them, η is the learning rate, η is 0.01, D is the defect type, c is the equipment parameter, ω new is the new conditional probability parameter, ω old is the old conditional probability parameter; adjust the conditional probability of the defect-equipment parameter according to the new data;

[0042] The incremental training mechanism only updates the fully connected layer parameters of the sub-model, and the loss function is:

[0043] L=α·L cls +(1-α)·L box ,α=0.8 (9),

[0044] Among them, L c1s is the cross entropy classification loss, L box For CIoU localization loss, the backbone network parameters are frozen during training.

[0045] Compared with the prior art, the present invention has the following beneficial effects:

[0046] The system uses a dynamic priority decision module to rationally select the priority of sub-models based on the device status and computing resource load, ensuring efficient computing resource utilization. During the detection process, multiple sub-models work in parallel, and a gradient mask training strategy is used to ensure the specific learning of each sub-model, avoiding unnecessary waste of computing resources. The system uses confidence screening and cascade control mechanisms. When the confidence level of the detection results is low or the variance is large, it automatically triggers a higher-precision sub-model for secondary detection, further improving detection accuracy. The system optimizes the sub-models through an incremental training mechanism based on the recall rate and false positive rate of each detection. Through the mutual cooperation of these modules, the system can dynamically adjust the detection strategy while ensuring high accuracy, reduce the computing burden, and achieve efficient and accurate PCB defect detection. Description of the drawings:

[0047] Figure 1 This is a flow chart of a PCB defect detection method based on an adaptive multi-submodel according to the present invention;

[0048] Figure 2 This is a functional block diagram of a PCB defect detection system module based on an adaptive multi-submodel according to the present invention;

[0049] Figure 3 This is a module structure diagram of a PCB defect detection system based on an adaptive multi-submodel in the present invention. Specific implementation method:

[0050] The specific embodiments of the present invention are described in detail below, but it should be understood that the protection scope of the present invention is not limited by the specific embodiments.

[0051] Unless expressly stated otherwise, throughout the specification and claims, the term "comprise" or variations such as "include" or "comprising", etc., will be understood to include the stated elements or components but not to exclude other elements or other components.

[0052] like Figure 3 As shown, a PCB defect detection system based on an adaptive multi-sub-model includes an image acquisition module, a dynamic priority control module, a detection execution module, and an evaluation feedback module; the image acquisition module acquires PCB bare board images through a high-resolution camera; the dynamic priority control module dynamically adjusts the priority order of the defect detection sub-model through reinforcement agent learning and Bayesian network; the detection execution module integrates a multi-sub-model network based on YOLOv8, uses a shared backbone network to extract multi-scale features of the image, and combines a gradient mask mechanism to perform specific training of the sub-model; the evaluation feedback module implements multi-level cascade detection by using confidence threshold screening and variance analysis, and reversely optimizes the parameters of the sub-model based on batch statistical results to dynamically adjust the detection strategy.

[0053] like Figure 1-2 As shown, a PCB defect detection method based on an adaptive multi-submodel comprises the following steps:

[0054] S01, the image acquisition module uses a high-resolution industrial camera to collect PCB bare board images and pre-process the images;

[0055] The image preprocessing method is to perform illumination correction on the image using the local neighborhood normalization algorithm. Assuming that the image size captured by an industrial camera is 1024×1024 pixels, the illumination correction formula is:

[0056]

[0057] Among them, x, y represent the coordinate points, I r (x,y) represents the brightness value of each pixel position (x,y) in the original image, Indicates averaging the brightness of neighboring pixels. represents the sum of the pixel brightness values ​​in a 9×9 neighborhood, and ε is an anti-zero constant.

[0058] Light correction is performed using the mean of 9×9 neighborhood pixels to avoid the effects of uneven lighting. This process ensures the accuracy of subsequent image processing.

[0059] The system then performs image segmentation and geometric correction. For example, for a 1024×1024 image, it divides it into multiple 512×512 pixel sub-images, with a 128-pixel overlap between each sub-image to ensure that edge defects are not missed during the segmentation process.

[0060] S02. The dynamic priority control module deploys reinforcement agent learning and Bayesian networks to dynamically generate priority queues for detection sub-models based on equipment parameters, defect distribution, and computing resources. Sub-models are determined based on defect types, including leaks, short circuits, rat bites, strays, miscellaneous copper, and open circuits. Reinforcement agent learning collects PCB ID, batch number, mean defect distribution of the last 10 inspections, and GPU utilization data in real time, and encodes the collected data into a 64-dimensional state vector. The sub-model detection order is dynamically adjusted based on the PCB status and defect distribution, and PCB parameters, defect types, and their distribution are monitored in real time. The execution order of the sub-models is automatically adjusted based on the monitoring data to prioritize the detection of areas where defects are more likely to occur. The Bayesian network simultaneously analyzes the conditional probability of equipment process parameters and defect types to verify the rationality of the priority queue. Equipment process parameters include drilling machine power and patch pressure.

[0061] Reinforcement agent learning involves constructing a state space and making decisions. The state space is defined as:

[0062] s t =[E ID ,B,D avg ,G]∈R 64 (2),

[0063] Among them, E ID It is the 8-dimensional simplified code of the device ID, used to identify the device; B is the batch number, D avg is the mean of the defect distribution of the last 10 inspections; G is the normalized GPU utilization, with low = 0, medium = 1, and high = 2;

[0064] Input the PCB ID, batch number, the mean of the defect distribution in the last 10 times and the GPU utilization into the state space. Assume that the PCB ID is encoded as an 8-dimensional vector [0,1,0,0,0,0,0,0], the batch number is B=1500, the normalized value is: B / 1000=1.5, and there are currently six types of defects (leakage, short circuit, rat bite, stray, miscellaneous copper, open circuit). The mean number of defects in the last 10 inspections is extracted as leakage (18%), short circuit (12%), rat bite (5%), and the GPU utilization is medium load (1). The state space is obtained as s t =[0,1,0,0,0,0,0,0,1.5,0.18,0.12,0.05,1] (dimensions: 8+1+3+1=13, with zeros added to any dimension less than 64);

[0065] Construct the state space to encode the collected data into a 64-dimensional state vector, and then convert the 64-dimensional state vector s t As the input of decision generation, decision generation is inferred and output by the double-delayed deep deterministic policy gradient TD3 algorithm. The decision generation output includes the sub-model priority queue 6-dimensional vector π∈R6 , represents the calling order of the six types of defect models and the confidence threshold adjustment Δτ∈[-0.2,+0.2];

[0066] The TD3 algorithm generates a priority queue: the 6-dimensional vector π = [0.9, 0.2, 0.1, 0.05, 0.03, 0.01], representing leaks → short circuits → rat bites → stray copper → stray circuits → open circuits. The confidence threshold is lowered from 0.85 to 0.8.

[0067] Decision generation is dynamically adjusted by the following reward function r:

[0068]

[0069] Among them, R t is the true positive rate of the current batch, with a weight of 3, is the penalty term when the GPU load is high; R t =0.92 (leak hole defect detection rate 92%), GPU is not overloaded (G=1, penalty term is 0), assuming a single time of 9 seconds, the calculated r=1.86;

[0070] Finally, we verify it through Bayesian network. Assuming that the power of the drilling machine is 25W (standard is 20W), we calculate P(leakage hole|power=25W)=0.85, confirming that the priority is reasonable.

[0071] Prioritize the 6-dimensional vector π∈R by sub-model 6 Generate the final priority queue, π = [1, 4, 2, 6, 5, 3] (leak → short circuit → rat bite → stray copper → stray → open circuit), and update the confidence threshold to τ = 0.85 + (-0.1) = 0.75, lowering it from 0.85 to 0.75 to improve sensitivity;

[0072] S03. Based on the preprocessed 512×512 sub-image, the YOLOv8 backbone network with the CSPDarknet architecture is used to extract multi-scale features. The backbone network outputs three sets of feature maps (shallow features: 80×80×256, middle features: 40×40×512, deep features: 20×20×1024). Assume that the input sub-image contains a rat bite defect (size 0.1mm×0.3mm) located in the upper left corner of the image. In the shallow feature map, the maximum activation value of all channels c∈{1,2,...,C} of each sub-model is calculated. The formula is:

[0073] max(A c )=max (i,j) A c (i,j)

[0074] Among them, A c(i, j) represents the activation value of the cth channel at position (i, j). The rat bite model has 256 channels. Assume that the maximum activation value of each channel is: max(A 32 )=0.7、max(A 45 )=0.6、max(A 78 )=0.3, current GPU utilization = medium (G=1), using the default threshold θ=0.5, generate the mask matrix:

[0075]

[0076] Then the gradient mask matrix of the mouse bite model is generated

[0077] During back propagation, a mask is applied to the gradient of each channel, allowing only The channel participates in the weight update;

[0078] When training the rat bite model, the backbone network weights remain frozen, channels 32 and 45 participate in gradient calculations and update the fully connected layer parameters, the gradient of channel 78 is blocked, and the weights remain unchanged;

[0079] S04. Combine the confidence threshold and historical variance to perform confidence screening and cascade control on the sub-models. Classify the confidence of the sub-model output to decide whether to trigger cascade control, and loop until the confidence meets the standard or all sub-models are traversed. If the confidence is ≥0.85, directly output the detection result and terminate the subsequent sub-model call. If the confidence is ∈ [0.6, 0.85) and the historical variance of similar defects is ≥0.1 (calculated based on the results of the last 50 similar detections), trigger the next level of sub-model detection. For overlapping detection frames with intersection over union (IoU) ≥0.5, only the one with the highest confidence is retained to suppress redundant detection results. Improve NMS to process overlapping frames, calculate the IoU value for all detection frames pairwise, and only retain the one with the highest confidence for detection frames that do not meet the retention conditions.

[0080] The steps of cascade control include: according to the dynamic priority queue, the short-circuit defect detection sub-model is called first, the short-circuit defect detection sub-model infers the input sub-graph, and outputs the confidence p of the short-circuit defect and the coordinates of the positioning box; assuming that the output confidence of the short-circuit sub-model is p = 0.78, the coordinates of the positioning box are (x1, y1, x2, y2); high confidence is directly output (p ≥ 0.85), medium confidence variance is triggered (p ∈ [0.6, 0.85)), low confidence skips subsequent detection (p < 0.6), the current confidence p = 0.78, and variance analysis is triggered; when variance analysis is triggered, the sequence of the nearly ten short-circuit defect confidences {p1, p2, ..., p 10}, calculate the historical variance:

[0081]

[0082] Among them, p k,i To express the confidence of defect type k in the i-th inspection, when When it is determined to be in a high variance state, the next level of detection is triggered;

[0083] After triggering the next level of detection, the rat bite sub-model is called to output the confidence level p of the rat bite defect. The confidence level p is graded and judged. When the confidence level is high, it is directly output. When the confidence level is medium, variance analysis is triggered. When the confidence level is low, subsequent detection is skipped. If the variance analysis shows a high variance state, the next level sub-model is called again until the confidence level meets the standard or all sub-models are traversed.

[0084] Improve NMS to handle overlapping frames, and keep the following rules:

[0085]

[0086] For detection boxes that do not meet the retention conditions, only the ones with the highest confidence are retained.

[0087] S05. After the detection is completed, the performance indicators of each sub-model are counted in batches and the priority score of the sub-model is calculated; the performance indicators include recall rate and false detection rate; the sub-model priority queue is re-sorted according to the priority score; incremental training is triggered for the sub-model with a recall rate <70% for three consecutive batches; the conditional probability parameters are updated through gradient descent, and the conditional probability of the defect-device parameters is adjusted according to the new data; the reinforcement learning strategy library is updated, and the new state-action-reward data is added to the training set.

[0088] After completing 100 tests, the test results of each sub-model are summarized and the recall rate R is calculated. k and inspection rate F k ; According to the recall rate R k and the false detection rate F k , update the detection sub-model priority according to the following formula:

[0089]

[0090] Add a 0.1 smoothing term to the denominator to avoid division by zero and balance the impact of false detection. Press P k Generate a new priority queue from high to low;

[0091] Bayesian network parameter update, update the conditional probability parameter ω through gradient descent,

[0092]

[0093] Among them, η is the learning rate, η is 0.01, D is the defect type, c is the equipment parameter, ω new is the new conditional probability parameter, ωold is the old conditional probability parameter; adjust the conditional probability of the defect-equipment parameter according to the new data;

[0094] Incremental training trigger condition: 3 consecutive batches of R k <0.7; using the latest 100 samples containing the defect, only unfreeze the fully connected layer parameters of the sub-model, and keep the weights of the shared feature extraction layer unchanged;

[0095] The incremental training mechanism only updates the fully connected layer parameters of the sub-model, and the loss function is:

[0096] L=α·L cls +(1-α)·L box ,α=0.8 (9),

[0097] Among them, L c1s is the cross entropy classification loss, L box For CIoU localization loss, the backbone network parameters are frozen during training.

[0098] The foregoing descriptions of specific exemplary embodiments of the present invention are for purposes of illustration and description. These descriptions are not intended to limit the invention to the precise forms disclosed, and it is apparent that many variations and modifications are possible in light of the foregoing teachings. The exemplary embodiments have been selected and described for the purpose of explaining the specific principles of the invention and their practical application, thereby enabling those skilled in the art to realize and utilize a variety of exemplary embodiments of the invention and various options and modifications. The scope of the invention is intended to be defined by the claims and their equivalents.

Claims

1. A PCB defect detection system based on an adaptive multi-submodel, characterized by: The system includes an image acquisition module, a dynamic priority control module, a detection execution module, and an evaluation feedback module; the image acquisition module uses a high-resolution camera to capture images of bare PCB boards; the dynamic priority control module dynamically adjusts the priority order of defect detection sub-models through reinforcement agent learning and Bayesian networks; the detection execution module integrates a multi-sub-model network based on YOLOv8, uses a shared backbone network to extract multi-scale features of images, and combines a gradient mask mechanism to perform specific training of sub-models; the evaluation feedback module uses confidence threshold screening and variance analysis to achieve multi-level cascade detection, and reversely optimizes the parameters of the sub-models based on batch statistical results to dynamically adjust the detection strategy.

2. A detection method for a PCB defect detection system based on an adaptive multi-submodel according to claim 1, comprising the following steps: S01, the image acquisition module uses a high-resolution industrial camera to collect PCB bare board images and pre-process the images; S02. The dynamic priority control module deploys reinforcement agent learning and Bayesian networks to dynamically generate priority queues for detection sub-models based on equipment parameters, defect distribution, and computing resources. Sub-models are determined based on defect types, including leaks, short circuits, rat bites, strays, miscellaneous copper, and open circuits. Reinforced agent learning collects PCB ID, batch number, the mean defect distribution of the last 10 inspections, and GPU utilization data in real time, and encodes the collected data into a 64-dimensional state vector. The sub-model detection order is dynamically adjusted based on the PCB status and defect distribution, and PCB parameters, defect types, and their distribution are monitored in real time. The execution order of the sub-models is automatically adjusted based on the monitoring data. The Bayesian network synchronously analyzes the conditional probability of equipment process parameters and defect types to verify the rationality of the priority queue. Equipment process parameters include drilling machine power and patch pressure. S03, using the YOLOv8 backbone network based on the CSPDarknet architecture to extract multi-scale features, calculate feature activation values ​​for each sub-model, screen out key channels for gradient mask generation, and use these key channels to train the sub-model; The gradient mask is adjusted according to the importance of each channel, ensuring that each sub-model can focus on the most critical features; S04. Confidence screening and cascade control are performed on sub-models based on the confidence threshold and historical variance. The confidence levels of the sub-model outputs are graded to determine whether to trigger cascade control. This cycle continues until the confidence level meets the threshold or all sub-models are traversed. If the confidence level of a detected defect is low and the historical variance exceeds the preset range, the system automatically initiates the next level of detection to reduce missed detections. Improve NMS to handle overlapping frames, calculate the IoU value for all detection frames pairwise, and only retain the detection frames with the highest confidence for those that do not meet the retention conditions; S05. After the detection is completed, the performance indicators of each sub-model are counted in batches and the priority score of the sub-model is calculated; the performance indicators include recall rate and false positive rate; the priority queue of the sub-model is re-sorted according to the priority score; Trigger incremental training for sub-models whose recall rate is less than 70% for three consecutive batches; update the conditional probability parameters through gradient descent, and adjust the conditional probability of defect-device parameters based on the new data; The reinforcement learning policy library is updated to include new state-action-reward data in the training set.

3. The PCB defect detection method based on the adaptive multi-submodel according to claim 2, characterized in that: In step S01, the image preprocessing method is to perform illumination correction on the image using a local neighborhood normalization algorithm. Assuming that the image size captured by an industrial camera is 1024×1024 pixels, the illumination correction formula is: Among them, x, y represent the coordinate points, I r (x,y) represents the brightness value of each pixel position (x,y) in the original image, Indicates averaging the brightness of neighboring pixels. represents the sum of the pixel brightness values ​​in a 9×9 neighborhood, and ε is an anti-zero constant.

4. The PCB defect detection method based on the adaptive multi-submodel according to claim 2, characterized in that: In step S02, reinforcement agent learning includes constructing a state space and making decisions. The state space is defined as: s t =[E ID ,B,D avg ,G]∈R 64 (2), Among them, E ID It is the 8-dimensional simplified code of the device ID, used to identify the device; B is the batch number, D avg is the mean of the defect distribution of the last 10 inspections; G is the normalized GPU utilization, with low = 0, medium = 1, and high = 2; Construct the state space to encode the collected data into a 64-dimensional state vector, and then convert the 64-dimensional state vector s t As the input of decision generation, decision generation is inferred and output by the double-delayed deep deterministic policy gradient TD3 algorithm. The decision generation output includes the sub-model priority queue 6-dimensional vector π∈R 6 , represents the calling order of the six types of defect models and the confidence threshold adjustment Δτ∈[-0.2,+0.2]; Decision generation is dynamically adjusted by the following reward function r: Among them, R t is the true positive rate of the current batch, with a weight of 3, It is the penalty term when the GPU load is high; The obtained sub-model priority queue 6-dimensional vector π∈R 6 , real-time acquisition of drilling machine power and patch pressure, verified by Bayesian network, and queued 6-dimensional vector π∈R according to the sub-model priority 6 Generate the final priority queue and send it to the detection execution module.

5. The PCB defect detection method based on the adaptive multi-submodel according to claim 2, characterized in that: In step S03, for each sub-model, the Grad-CAM algorithm is used to calculate the contribution of the feature channels, and the key channels with contributions ≥ the activation threshold are retained for gradient backpropagation, while the remaining channels are frozen and updated: Among them, C kc is the activation value of channel c to defect k, that is, the feature channel contribution calculated by the Grad-CAM algorithm, and θ is the activation threshold; θ is dynamically adjusted based on GPU utilization:

6. The PCB defect detection method based on the adaptive multi-submodel according to claim 2, characterized in that: In step S04, the cascade control steps include: according to the priority queue obtained in step S02, the short-circuit defect detection sub-model is preferentially called, the short-circuit defect detection sub-model performs reasoning on the input sub-graph, and outputs the confidence p of the short-circuit defect and the coordinates of the positioning frame; the confidence p is graded and directly output when the confidence is high, variance analysis is triggered when the confidence is medium, and subsequent detection is skipped when the confidence is low; when variance analysis is triggered, the sequence of the confidences of the last ten short-circuit defects {p1, p2, ..., p 10 }, calculate the historical variance: Among them, p k,i is the confidence level of defect type k in the i-th inspection, p k,j is the confidence level of defect type k in the jth inspection, when When it is determined to be in a high variance state, the next level of detection is triggered; After triggering the next level of detection, the rat bite sub-model is called to output the confidence level p of the rat bite defect. The confidence level p is graded and judged. When the confidence level is high, it is directly output. When the confidence level is medium, variance analysis is triggered. When the confidence level is low, subsequent detection is skipped. If the variance analysis shows a high variance state, the next level sub-model is called again until the confidence level meets the standard or all sub-models are traversed. Improve NMS to handle overlapping frames, and keep the following rules: For detection boxes that do not meet the retention conditions, only the ones with the highest confidence are retained.

7. The PCB defect detection method based on the adaptive multi-submodel according to claim 2, characterized in that: In step S05, according to the recall rate R k and the false detection rate F k , update the detection sub-model priority P according to the following formula k : Bayesian network parameter update, update the conditional probability parameter ω through gradient descent, Among them, η is the learning rate, η is 0.01, D is the defect type, c is the equipment parameter, ω new is the new conditional probability parameter, ω old is the old conditional probability parameter; adjust the conditional probability of the defect-equipment parameter according to the new data; The incremental training mechanism only updates the fully connected layer parameters of the sub-model, and the loss function is: L=α·L cls +(1-a)·L box ,α=0.8 (9), Among them, L c1s is the cross entropy classification loss, L box For CIoU localization loss, the backbone network parameters are frozen during training.

Citation Information

Patent Citations

  • PCB defect detection system and PCB defect detection method

    CN114820598A

  • Coflow scheduling system based on TD3 algorithm

    CN116582502A

  • Lightweight PCB defect detection method and system based on high-order space interaction

    CN117094972A

  • Oil depot tank field inspection robot task allocation method and system based on Internet of Things

    CN119417192A

  • Weld seam internal defect intelligent detection device and method, and medium

    WO2022053001A1

Cited By

  • Capacitor defect detection method based on YOLOv5 model

    CN120976220A

  • Road defect self-adaptive detection method and system

    CN121707965A