A PCB micro-defect detection method for lightweight deployment

CN122966568APending Publication Date: 2026-10-23BEIHANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611115424.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-27
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

解决现有YOLO模型在PCB微小缺陷检测中存在的特征细节易丢失、复杂背景干扰强、模型参数量较大以及边界框定位约束不足的问题

Benefits of technology

(1)、本发明通过部分通道动态增强C3K2模块、动态多尺度增强模块和轻量化通道重组共享检测头对YOLO11网络进行改进,在增强PCB微小缺陷局部纹理、边缘细节和多尺度特征表达能力的同时,减少了主干网络和检测端的冗余参数与计算量;并通过Wise-inner-MPDIoU损失函数增强小目标边界框定位约束,提高微小缺陷检测的稳定性;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122966568A_ABST
    Figure CN122966568A_ABST
Patent Text Reader

Abstract

The application relates to a PCB micro-defect detection method for light-weight deployment, and belongs to the fields of computer vision and printed circuit board defect detection, and comprises the following steps: acquiring a DeepPCB printed circuit board defect image and performing label format conversion, sample verification and dataset division; an improved YOLO11 target detection model is constructed, a partial channel dynamic enhancement C3K2 module is arranged in a backbone network, and a dynamic multi-scale enhancement module is arranged in a deep feature extraction part; a light-weight channel reorganization shared detection head is arranged at a network output end; in a training stage, a Wise-inner-MPDIOU loss function is introduced to optimize a boundary box regression process; and a trained model is used for defect detection on a PCB image to be detected. The application can significantly reduce the model complexity while maintaining high detection precision, improve the reasoning speed, and is suitable for PCB defect real-time detection in a limited computing power scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer vision and printed circuit board defect detection, and relates to a method for detecting minute defects in PCBs for lightweight deployment. Background Technology

[0002] Printed Circuit Boards (PCBs), as fundamental interconnect components in electronic devices, support electronic components and enable electrical connections. Their quality and reliability directly affect the stability and lifespan of electronic products. As electronic products trend towards miniaturization and high density, PCB manufacturing processes are becoming increasingly sophisticated. However, defects such as open circuits, short circuits, rodent bites, burrs, exposed copper, and pinholes can still occur during production due to material defects, etching residues, drilling deviations, and exposure alignment errors. If these defects are not detected in time, they can easily lead to abnormal circuit connections and unstable signal transmission, thus affecting product quality.

[0003] Traditional PCB defect detection methods mainly rely on manual visual inspection, electrical testing, and image processing-based machine vision methods. Among these, manual visual inspection is greatly affected by the experience and fatigue level of the inspectors, making it difficult to guarantee inspection efficiency and consistency. Electrical testing has some ability to detect continuity anomalies, but it is difficult to accurately reflect the shape and location of small surface defects. Traditional machine vision methods are usually based on edge extraction, threshold segmentation, morphological processing, and template matching techniques, which are effective in situations with simple backgrounds and obvious defect shapes, but have limited adaptability to complex circuit textures, weak edge defects, and small targets.

[0004] In recent years, with the development of deep learning technology, convolutional neural networks have demonstrated strong feature extraction capabilities in image classification and object detection, driving the intelligent development of PCB defect detection. The YOLO series of algorithms, as a typical one-stage object detection method, can unify object localization and category prediction into an end-to-end detection framework, achieving good recognition results while maintaining high detection speed. Therefore, it has been increasingly applied to industrial defect detection scenarios.

[0005] However, in PCB defect detection tasks, defects are often small in size, have indistinct edges, and are easily affected by complex background structures such as traces, pads, and holes. Existing YOLO-based detection models, when directly applied to such scenarios, may still suffer from insufficient representation of minute defect features, unstable bounding box localization, and high computational costs, making it difficult to simultaneously meet the requirements of high-precision detection and lightweight deployment. Therefore, it is necessary to propose a PCB minute defect detection method for lightweight deployment. Summary of the Invention

[0006] This invention proposes a method for detecting minute defects in PCBs with lightweight deployment capabilities. This method achieves this through synergistic improvement using a partially channel dynamically enhanced C3K2 module, a dynamic multi-scale deep convolution enhancement module, a lightweight channel recombination shared detection head, and a Wise-inner-MPDIoU loss function. This reduces the number of model parameters and computational cost while maintaining PCB defect detection accuracy, thereby improving model inference speed and lightweight deployment capabilities. It addresses the problems of existing YOLO models in PCB minute defect detection, such as easy loss of feature details, strong interference from complex backgrounds, large model parameter count, and insufficient bounding box localization constraints.

[0007] A method for detecting minute defects in PCBs for lightweight deployment includes the following steps: Step S1: Obtain the DeepPCB dataset of printed circuit board defects. Preprocess the PCB defect images and their annotation files in the dataset to obtain the preprocessed DeepPCB dataset. Step S2, let t =1, when t =1 indicates the initial number of iterations; Step S3: Obtain the first data point from the preprocessed DeepPCB dataset. t The next iteration of the printed circuit board (PCB) defect image is input into the improved YOLO11 target detection model. A t After the basic feature extraction layer B t Partial channel dynamic enhancement C3K2 module C t Perform local texture and edge detail feature enhancement, and output the first... t Dynamic enhancement features in each iteration; Step S4, the t The enhanced features of the next iteration are processed through feature transfer and feature fusion structures. D t Furthermore, a dynamic multi-scale deep convolution enhancement module is used in the mid-to-high-level semantic feature extraction stage. E t Perform multi-scale context enhancement and output the first... t Multi-scale enhancement features in multiple iterations; Step S5: t The next iteration uses multi-scale enhanced feature input, lightweight channel reorganization, and shared detection head. F t Output the first t The prediction results of the PCB defect target in the next iteration include the category prediction results, the bounding box location prediction results, and the confidence level; The first tThe predicted PCB defect targets of the next iteration are matched with the actual annotation information, and the predicted results of the next iteration are calculated. t The total loss of the improved YOLO11 object detection model in the next iteration; According to the t The total loss of the nth iteration is backpropagated to update the nth iteration. t The trainable parameters of the improved YOLO11 object detection model in the second iteration are obtained. t The updated and improved YOLO11 object detection model in the next iteration, as the first iteration... t An improved YOLO11 object detection model with +1 iteration; Step S6, Judgment t Is it greater than or equal to? T , T Let represent the total number of iterations. If yes, the final improved YOLO11 object detection model is obtained; otherwise, let . t = t +1, return to step S3; Step S7: Input the DeepPCB test set or any PCB image to be inspected into the final improved YOLO11 target detection model, and output the detection results of the PCB defect image. Step S8: Filter the detection results of the PCB defect image using confidence threshold and perform non-maximum suppression, then output the final detection results of the PCB defect image, including the category label, bounding box coordinates, and corresponding confidence score for each defect target.

[0008] Optionally, step S3 specifically includes: Step S3.1: Input the PCB defect image of the current iteration into the improved YOLO11 target detection network, and pass it through the basic feature extraction layer. B t In the C3K2 module, which dynamically enhances certain channels, the PCB defect map of the current iteration is divided into the first channel features. Second channel features ; Step S3.2: Extract the first channel features of the current iteration. Perform frequency domain dynamic enhancement to obtain frequency domain enhancement features. ; Enhance frequency domain features Features of the second channel By concatenating the data along the channel dimension, we obtain the hybrid features of the current iteration after dynamic enhancement of some channels. ; Step S3.3: Combine the mixed features of the current iteration. Input channel blending unit, output channel blending feature of the current iteration. ; The defect feature map of the current iteration Mixed features with corresponding channels The features are added together to obtain the dynamic enhancement features for the current iteration.

[0009] Optionally, some channels of the C3K2 dynamic enhancement module include an input channel adjustment unit, a channel partitioning unit, a frequency domain dynamic convolution enhancement unit, a direct connection retention unit, a channel splicing unit, a channel mixing unit, and a residual connection unit.

[0010] Optionally, the input channel adjustment unit is used to adjust the channels of the input feature map through convolution to meet the channel requirements of subsequent feature processing and residual connections; The channel partitioning unit is used to divide the adjusted features into a first channel feature branch and a second channel feature branch along the channel dimension; The frequency domain dynamic convolution enhancement unit is used to perform FDConv dynamic enhancement on the first channel feature branch; the direct connection preservation unit is used to ensure that the second channel feature branch retains the original information transmission. The channel splicing unit is used to splice the enhanced first channel feature with the retained second channel feature; The channel mixing unit is used to perform inter-channel information exchange on the spliced ​​features; The residual connection unit is used to add the channel-adjusted input features to the channel-mixed features to obtain the output features.

[0011] Optionally, the dynamic multi-scale enhancement module is set at the mid-to-high-level semantic feature output position of the backbone network to perform multi-scale dynamic enhancement on feature maps containing strong semantic information, so as to improve the network's ability to perceive the context of PCB defect areas.

[0012] Optionally, the lightweight channel recombination shared detection head adopts a method made by The feature mapping unit, composed of convolution, group normalization, and activation functions, maps its channel number to a preset number of hidden channels. A feature map with unified channel dimensions is obtained. ; Feature maps of unified channel dimensions at various scales Input the same set of shared convolutional enhancement units to obtain the output features of feature maps at each scale after being enhanced by shared convolution.

[0013] Optionally, trainable parameters include convolution parameters, normalization parameters, and trainable parameters in the partial channel dynamic enhancement C3K2 module, the dynamic multi-scale deep convolution enhancement module, and the lightweight channel recombination shared detection head.

[0014] Optionally, the Wise-inner-MPDIoU loss function can be introduced during the training phase to optimize the bounding box regression process.

[0015] Optionally, the expression for the Wise-inner-MPDIoU loss function is:

[0016] in, Indicates inner-MPDIoU loss. This represents the dynamic focusing coefficient, used to dynamically adjust the gradient gain of the bounding box regression loss based on sample quality. This represents the sample quality evaluation factor.

[0017] Optionally, the expressions for the sample quality evaluation factor and the dynamic focusing coefficient are as follows:

[0018] in, For hyperparameter one, For hyperparameter two, For Inner-MPDIoU loss, The moving average of the Inner-MPDIoU loss.

[0019] Compared with the prior art, the present invention has at least the following beneficial effects: (1) This invention improves the YOLO11 network by using a partial channel dynamic enhancement C3K2 module, a dynamic multi-scale enhancement module, and a lightweight channel recombination shared detection head. While enhancing the ability to express local texture, edge details, and multi-scale features of PCB micro-defects, it reduces redundant parameters and computational load in the backbone network and detection end. Furthermore, it enhances the localization constraint of small target bounding boxes by using the Wise-inner-MPDIoU loss function, thereby improving the stability of micro-defect detection. (2) The present invention can reduce the number of model parameters, computational load and model file size while maintaining high PCB defect detection accuracy, and improve model inference speed, thereby reducing the dependence on hardware computing resources and facilitating real-time PCB defect detection in scenarios with limited computing power, such as industrial inspection equipment and edge computing equipment. Attached Figure Description

[0020] The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of the invention.

[0021] Figure 1 This is a flowchart of a lightweight PCB defect detection method based on an improved YOLO11 in an embodiment of the present invention; Figure 2 This is a schematic diagram of the overall structure of the improved YOLO11 lightweight PCB defect detection model in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of some channel dynamic enhancement modules in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of the dynamic multi-scale enhancement module in an embodiment of the present invention; Figure 5 This is a schematic diagram of the lightweight channel recombination shared detection head structure in an embodiment of the present invention; Figure 6 This is a schematic diagram comparing the detection performance of the baseline model and the improved model of this invention on a DeepPCB test image in an embodiment of the present invention. Detailed Implementation

[0022] To better understand the above-described objectives, features, and advantages of the present invention, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments of the present invention and the features thereof can be combined with each other. Furthermore, the present invention can be implemented in other ways different from those described herein; therefore, the scope of protection of the present invention is not limited to the specific embodiments disclosed below.

[0023] A specific embodiment of the present invention, such as Figure 1-6 A method for detecting minute defects in PCBs for lightweight deployment is disclosed, comprising the following steps: Step S1: Obtain the DeepPCB dataset of printed circuit board defects. Preprocess the PCB defect images and their annotation files in the dataset to obtain the preprocessed DeepPCB dataset. Optionally, the preprocessing described in step S1 is as follows: converting the defect category and bounding box coordinate information in the original annotation file of the DeepPCB printed circuit board defect dataset into YOLO format labels, and converting the bounding box coordinates into normalized center point coordinates and width and height representations; performing consistency checks on the images and label files, and removing samples with missing labels, abnormal categories, bounding boxes that are out of bounds, or invalid width and height, in order to ensure the effectiveness of the dataset and the stability of training. Optionally, the PCB defect categories are open circuit, short circuit, rodent bite, burr, exposed copper, and pinhole.

[0024] Optionally, 1500 PCB defect images and their corresponding YOLO format label files are obtained, containing a total of 10013 defect target boxes.

[0025] The processed dataset was randomly divided into training, validation, and test sets in an 8:1:1 ratio. The training set contained 1200 images, the validation set contained 150 images, and the test set contained 150 images. The partitioned dataset was organized according to the YOLO standard directory structure, and a data configuration file containing the number of classes, class names, and training, validation, and testing paths was generated. This configuration file was used to improve the training, parameter selection, and performance testing of the YOLO11 model.

[0026] Step S2, let t =1, when t =1 indicates the initial number of iterations; Step S3: Obtain the first data point from the preprocessed DeepPCB dataset. t The next iteration of the printed circuit board (PCB) defect image is input into the improved YOLO11 target detection model. A t After the basic feature extraction layer B t Partial channel dynamic enhancement C3K2 module C t Perform local texture and edge detail feature enhancement, and output the first... t Dynamic enhancement features in each iteration; Optionally, the YOLO11 object detection network includes a partially channel dynamic enhancement C3K2 module and a dynamic multi-scale depth convolution enhancement module; Optionally, some channels of the C3K2 dynamic enhancement module include an input channel adjustment unit, a channel partitioning unit, a frequency domain dynamic convolution enhancement unit, a direct connection retention unit, a channel splicing unit, a channel mixing unit, and a residual connection unit.

[0027] The input channel adjustment unit is used to adjust the channels of the input feature map through convolution to meet the channel requirements of subsequent feature processing and residual connections. The channel partitioning unit is used to divide the adjusted features into a first channel feature branch and a second channel feature branch along the channel dimension; The frequency domain dynamic convolution enhancement unit is used to perform FDConv dynamic enhancement on the first channel feature branch; the direct connection preservation unit is used to ensure that the second channel feature branch retains the original information transmission. The channel splicing unit is used to splice the enhanced first channel feature with the retained second channel feature; The channel mixing unit is used to perform inter-channel information exchange on the spliced ​​features; The residual connection unit is used to add the channel-adjusted input features to the channel-mixed features to obtain the output features.

[0028] In this invention, the C3K2 module with partial channel dynamic enhancement retains the framework including branching, cross-layer connection, feature splicing and end fusion, as well as some channel dynamic enhancement units, to achieve lightweight enhancement of the C3K2 module without changing the overall topology connection relationship of YOLO11.

[0029] Optionally, step S3 specifically includes: Step S3.1: Obtain the PCB defect diagram for the current iteration. The input is a modified YOLO11 object detection network, passing through a basic feature extraction layer. B t In the C3K2 module, which dynamically enhances certain channels, the PCB defect map of the current iteration is divided into the first channel features. Second channel features ,in, Indicates the number of channels. Indicates the height of the feature map. Indicates the width of the feature map. The number of channels is , The number of channels is , In one embodiment, the channel partitioning ratio is used as a factor. =4; Step S3.2: Extract the first channel features of the current iteration. The input convolution kernel size is Frequency domain dynamic enhancement is performed using frequency domain dynamic convolution FDConv to obtain frequency domain enhanced features. ; Enhance frequency domain features Features of the second channel By concatenating the data along the channel dimension, we obtain the hybrid features of the current iteration after dynamic enhancement of some channels. ; Step S3.3: Combine the mixed features of the current iteration. Input channel blending unit, output channel blending feature of the current iteration. ; The defect feature map of the current iteration Mixed features with corresponding channels Add them together to obtain the dynamic enhancement features for the current iteration; Optionally, channel blending features The expression is:

[0030] in, express The up-dimensional convolution operation, express Dimensionality reduction convolution operation.

[0031] Optionally, the channel mixing unit includes a first Convolutional layer and second Convolutional layer; first convolution To expand the channel dimension and enhance information interaction between different channels, its convolutional processing unit includes... Convolution, normalization, and activation operations; the second convolution It is a linear convolutional layer used to restore the expanded channel dimension to the original number of channels, thereby completing feature reorganization with low computational cost.

[0032] The channel mixing unit employs two Lightweight channel interaction structure composed of convolutional layers; The partially channel dynamic enhancement C3K2 module of the present invention can reduce the computational redundancy caused by full-channel dynamic convolution, enhance the expression of local textures, edge details and weak feature regions of PCB defects, and maintain feature transfer stability through the original cross-layer connection framework of C3K2.

[0033] Step S4, the t The enhanced features of the next iteration are processed through feature transfer and feature fusion structures. D t Furthermore, a dynamic multi-scale deep convolution enhancement module is used in the mid-to-high-level semantic feature extraction stage. E t Perform multi-scale context enhancement and output the first... t Multi-scale enhancement features in multiple iterations; Optionally, the dynamic multi-scale deep convolutional enhancement module performs global context compression on the defect feature map through adaptive global average pooling to obtain global channel description information; Convolution expands the channel dimension to five times the original number of channels and divides them into five groups of channel weights; in the feature enhancement branch, the dynamic multi-scale enhancement module is set sequentially. Depth convolution, convolution, Depth convolution, Convolution and Depthwise convolution is used, where each convolutional stage is connected in a cascaded manner and multiplied element-wise with the corresponding dynamic channel weights.

[0034] Optionally, the dynamic multi-scale enhancement module is set at the mid-to-high-level semantic feature output position of the backbone network to perform multi-scale dynamic enhancement on feature maps containing strong semantic information, so as to improve the network's ability to perceive the context of PCB defect areas. This invention uses cascaded multi-scale convolution and dynamic weight adjustment to gradually expand the feature receptive field, thereby enhancing the model's ability to perceive PCB defect regions at different scales with lower parameter and computational requirements.

[0035] Step S5: t The next iteration uses multi-scale enhanced feature input, lightweight channel reorganization, and shared detection head. F t Output the first t The prediction results of the PCB defect target in the next iteration include the category prediction results, the bounding box location prediction results, and the confidence level; The first t The predicted PCB defect targets of the next iteration are matched with the actual annotation information, and the predicted results of the next iteration are calculated. t The total loss of the improved YOLO11 object detection model in the next iteration; According to the t The total loss of the nth iteration is backpropagated to update the nth iteration. t The trainable parameters of the improved YOLO11 object detection model in the second iteration are obtained. t The updated and improved YOLO11 object detection model in the next iteration, as the first iteration... t An improved YOLO11 object detection model with +1 iteration; Optionally, the lightweight channel reconfiguration shared detection head adopts a design by... The feature mapping unit, composed of convolution, group normalization, and activation functions, maps its channel number to a preset number of hidden channels. A feature map with unified channel dimensions is obtained. ; Feature maps of unified channel dimensions at various scales Input the same set of shared convolutional enhancement units to obtain the output features of feature maps at each scale after being enhanced by shared convolution.

[0036] Optionally, the shared convolutional enhancement unit includes sequentially connected Channel reconvolution and In depthwise convolution, the same set of parameters is used for feature extraction across multiple detection scales by sharing convolutional enhancement units. This setting eliminates the need for separate configuration of repetitive convolutional enhancement structures for different scale detection layers, thereby reducing parameter redundancy in the detection head and ensuring that features at different resolutions undergo a consistent feature enhancement process before prediction.

[0037] The expressions for feature maps at each scale are:

[0038]

[0039] in, Indicates the first Each scale feature map Indicates the first Each scale corresponds to a feature mapping unit. Indicates the first The output features of each scale feature map are enhanced by shared convolution. This means the number of groups equals the number of hidden channels. Depth-wise convolution normalization processing This indicates a convolution operation shared across scales. This represents a feature mapping unit.

[0040] After being processed by the shared convolutional enhancement unit, the feature maps are input into the bounding box regression prediction unit and the category prediction unit, respectively.

[0041] Step S6, Judgment t Is it greater than or equal to? T , T Let represent the total number of iterations. If yes, the final improved YOLO11 object detection model is obtained; otherwise, let . t = t +1, return to step S3; Step S7: Input the DeepPCB test set or any PCB image to be inspected into the final improved YOLO11 target detection model, and output the detection results of the PCB defect image. Step S8: Filter the detection results of the PCB defect image using confidence threshold and perform non-maximum suppression, then output the final detection results of the PCB defect image, including the category label, bounding box coordinates, and corresponding confidence score for each defect target.

[0042] Optionally, confidence threshold filtering: low-quality prediction boxes with confidence scores below a preset threshold (usually set to 0.25) are removed to reduce false detections; Non-maximum suppression (NMS): Sort the remaining predicted boxes in descending order of confidence, calculate the intersection-over-union ratio (IoU) between each box, remove overlapping boxes with IoU exceeding a set threshold, retain the best prediction, and eliminate redundant detection. The improved YOLO11 object detection model in this application includes a backbone feature extraction part, a dynamic multi-scale feature enhancement part, a lightweight channel recombination shared detection head, and a training loss optimization part.

[0043] The main feature extraction part is used to extract multi-level features of PCB defect images. The original C3K2 feature extraction module is replaced with a partially channel dynamically enhanced C3K2 module to reduce redundant calculations and enhance the expression of local texture and edge detail features. The dynamic multi-scale feature enhancement part is set in the mid-to-high-level semantic feature extraction stage of the backbone network, and is used to perform multi-scale dynamic enhancement on feature maps containing strong semantic information. The lightweight channel recombination shared detection head is set at the network output end to perform channel unification and shared convolution enhancement on features of different scales, and outputs the defect category prediction results and bounding box regression results respectively. Optionally, trainable parameters include convolution parameters, normalization parameters, and trainable parameters in the partial channel dynamic enhancement C3K2 module, the dynamic multi-scale deep convolution enhancement module, and the lightweight channel recombination shared detection head.

[0044] Optionally, during training, the validation set is used to evaluate the model's training status and help determine the model weights.

[0045] Optionally, the Wise-inner-MPDIoU loss function can be introduced during the training phase to optimize the bounding box regression process; The expression for the Wise-inner-MPDIoU loss function is:

[0046] in, Indicates inner-MPDIoU loss. This represents the dynamic focusing coefficient, used to dynamically adjust the gradient gain of the bounding box regression loss based on sample quality. This represents the sample quality evaluation factor.

[0047] The expressions for the sample quality evaluation factor and the dynamic focusing coefficient are as follows:

[0048] in, For hyperparameter one, For hyperparameter two, The moving average of the Inner-MPDIoU loss.

[0049] The expression for the inner-MPDIoU loss function is:

[0050] in, , The intersection-over-union ratio (IoU) represents the ratio between the predicted and ground truth bounding boxes. The corner distance term is used to constrain the positional and scale deviations between the predicted and ground truth bounding boxes. The inner auxiliary box corresponding to the predicted box. This is the inner auxiliary box corresponding to the real box. The top left corner of the prediction box. The bottom right corner of the prediction box. The top left corner of the true bounding box. The bottom right corner of the true bounding box. This is the normalization scaling term.

[0051] The expressions for the inner auxiliary boxes corresponding to the predicted bounding box and the inner auxiliary boxes corresponding to the ground truth bounding box are as follows:

[0052]

[0053] in, This is the scaling factor for the internal auxiliary box, which is set to 0.7 in one embodiment. To predict the center point of the bounding box x Axis coordinates To predict the center point of the bounding box y Axis coordinates To predict the height of the bounding box, To predict the width of the bounding box, The center point of the true bounding box x Axis coordinates The center point of the true bounding box y Axis coordinates The width of the actual bounding box. This represents the height of the actual bounding box.

[0054] This invention employs Inner-MPDIoU loss to jointly constrain the overlap relationship of internal auxiliary boxes and the distance between corner points. This invention can enhance the model's constraints on the internal region of PCB micro-defects, corner point positions, and bounding box scale during the training phase, thereby improving the bounding box regression stability.

[0055] To verify the effectiveness of the method of the present invention, this embodiment compares the baseline model YOLOv11n with the model of the present invention under the same DeepPCB test set, the same experimental environment, the same parameter settings, and the same evaluation metrics. The evaluation content includes recall rate and mAP50 for different defect categories, as well as lightweight metrics such as model parameter count, GFLOPs, model file size, and FPS.

[0056] Table 1 Comparison of recall and mAP50 for different target categories on the DeepPCB test set.

[0057] As shown in Table 1, on the DeepPCB test set, the average recall of the improved model of this invention increased from 95.29% to 95.59%, an increase of 0.30 percentage points; the average mAP50 increased from 98.73% to 98.89%, an increase of 0.16 percentage points. The recall or mAP50 of minor defects such as rodent bites, burrs, and pinholes showed significant improvements, indicating that the method of this invention can enhance the detection capability of minor defects in PCBs.

[0058] Meanwhile, the number of parameters in the improved model decreased from 2,583,322 to 783,084, GFLOPs decreased from 6.3 to 4.6, the model file size decreased from 5.3MB to 1.7MB, and the FPS increased from 149.16 to 164.92. This shows that the present invention reduces model complexity and improves detection speed while maintaining detection accuracy, making it more suitable for lightweight deployment in PCB defect detection scenarios.

[0059] Furthermore, such as Figure 6 As shown, under the same test image conditions, compared with the baseline model, the model of the present invention can more completely identify the small defects of PCB and improve the situation of missing some defects.

[0060] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for detecting minute defects in PCBs for lightweight deployment, characterized in that, include: Step S1: Obtain the DeepPCB dataset of printed circuit board defects. Preprocess the PCB defect images and their annotation files in the dataset to obtain the preprocessed DeepPCB dataset. Step S2, let t =1, when t =1 indicates the initial number of iterations; Step S3: Obtain the first data point from the preprocessed DeepPCB dataset. t The next iteration of the printed circuit board (PCB) defect image is input into the improved YOLO11 target detection model. A t After the basic feature extraction layer B t Partial channel dynamic enhancement C3K2 module C t Perform local texture and edge detail feature enhancement, and output the first... t Dynamic enhancement features in each iteration; Step S4, the t The enhanced features of the next iteration are processed through feature transfer and feature fusion structures. D t Furthermore, a dynamic multi-scale deep convolution enhancement module is used in the mid-to-high-level semantic feature extraction stage. E t Perform multi-scale context enhancement and output the first... t Multi-scale enhancement features in multiple iterations; Step S5: t The next iteration uses multi-scale enhanced feature input, lightweight channel reorganization, and shared detection head. F t Output the first t The prediction results of the PCB defect target in the next iteration include the category prediction results, the bounding box location prediction results, and the confidence level; The first t The predicted PCB defect targets of the next iteration are matched with the actual annotation information, and the predicted results of the next iteration are calculated. t The total loss of the improved YOLO11 object detection model in the next iteration; According to the t The total loss of the nth iteration is backpropagated to update the nth iteration. t The trainable parameters of the improved YOLO11 object detection model in the second iteration are obtained. t The updated and improved YOLO11 object detection model in the next iteration, as the first iteration... t An improved YOLO11 object detection model with +1 iteration; Step S6, Judgment t Is it greater than or equal to? T , T Let represent the total number of iterations. If yes, the final improved YOLO11 object detection model is obtained; otherwise, let . t = t +1, return to step S3; Step S7: Input the DeepPCB test set or any PCB image to be inspected into the final improved YOLO11 target detection model, and output the detection results of the PCB defect image. Step S8: Filter the detection results of the PCB defect image using confidence threshold and perform non-maximum suppression, then output the final detection results of the PCB defect image, including the category label, bounding box coordinates, and corresponding confidence score for each defect target.

2. The PCB micro-defect detection method for lightweight deployment according to claim 1, characterized in that, Step S3 specifically includes: Step S3.1: Input the PCB defect image of the current iteration into the improved YOLO11 target detection network, and pass it through the basic feature extraction layer. B t In the C3K2 module, which dynamically enhances certain channels, the PCB defect map of the current iteration is divided into the first channel features. Second channel features ; Step S3.2: Extract the first channel features of the current iteration. Perform frequency domain dynamic enhancement to obtain frequency domain enhancement features. ; Enhance frequency domain features Features of the second channel By concatenating the data along the channel dimension, we obtain the hybrid features of the current iteration after dynamic enhancement of some channels. ; Step S3.3: Combine the mixed features of the current iteration. Input channel blending unit, output channel blending feature of the current iteration. ; The defect feature map of the current iteration Mixed features with corresponding channels The features are added together to obtain the dynamic enhancement features for the current iteration.

3. The PCB micro-defect detection method for lightweight deployment according to claim 1, characterized in that, The C3K2 module for partial channel dynamic enhancement includes an input channel adjustment unit, a channel partitioning unit, a frequency domain dynamic convolution enhancement unit, a direct connection retention unit, a channel splicing unit, a channel mixing unit, and a residual connection unit.

4. The PCB micro-defect detection method for lightweight deployment according to claim 3, characterized in that, The input channel adjustment unit is used to adjust the channels of the input feature map through convolution to meet the channel requirements of subsequent feature processing and residual connections. The channel partitioning unit is used to divide the adjusted features into a first channel feature branch and a second channel feature branch along the channel dimension; The frequency domain dynamic convolution enhancement unit is used to perform FDConv dynamic enhancement on the first channel feature branch; the direct connection preservation unit is used to ensure that the second channel feature branch retains the original information transmission. The channel splicing unit is used to splice the enhanced first channel feature with the retained second channel feature; The channel mixing unit is used to perform inter-channel information exchange on the spliced ​​features; The residual connection unit is used to add the channel-adjusted input features to the channel-mixed features to obtain the output features.

5. The PCB micro-defect detection method for lightweight deployment according to claim 1, characterized in that, The dynamic multi-scale enhancement module is set at the mid-to-high-level semantic feature output position of the backbone network. It is used to perform multi-scale dynamic enhancement on feature maps containing strong semantic information to improve the network's context awareness of PCB defect areas.

6. The PCB micro-defect detection method for lightweight deployment according to claim 1, characterized in that, The lightweight channel reconfiguration shared detection head adopts a design based on... The feature mapping unit, composed of convolution, group normalization, and activation functions, maps its channel number to a preset number of hidden channels. A feature map with unified channel dimensions is obtained. ; Feature maps of unified channel dimensions at various scales Input the same set of shared convolutional enhancement units to obtain the output features of feature maps at each scale after being enhanced by shared convolution.

7. The PCB micro-defect detection method for lightweight deployment according to claim 1, characterized in that, Trainable parameters include convolution parameters, normalization parameters, and trainable parameters in the partial channel dynamic enhancement C3K2 module, dynamic multi-scale deep convolution enhancement module, and lightweight channel recombination shared detection head.

8. The PCB micro-defect detection method for lightweight deployment according to claim 1, characterized in that, The Wise-inner-MPDIoU loss function is introduced during the training phase to optimize the bounding box regression process.

9. The PCB micro-defect detection method for lightweight deployment according to claim 8, characterized in that, The expression for the Wise-inner-MPDIoU loss function is: in, Indicates inner-MPDIoU loss. This represents the dynamic focusing coefficient, used to dynamically adjust the gradient gain of the bounding box regression loss based on sample quality. This represents the sample quality evaluation factor.

10. The PCB micro-defect detection method for lightweight deployment according to claim 9, characterized in that, The expressions for the sample quality evaluation factor and the dynamic focusing coefficient are as follows: in, For hyperparameter one, For hyperparameter two, For Inner-MPDIoU loss, The moving average of the Inner-MPDIoU loss.