A PCB defect detection method based on adaptive alignment frequency module

By introducing an adaptive alignment frequency module into YOLOv11n, effective alignment and fusion of multi-scale features are achieved, solving the problems of insufficient detection accuracy and real-time performance in existing technologies, and improving the stability and accuracy of PCB defect detection.

CN122289236APending Publication Date: 2026-06-26XI'AN PETROLEUM UNIVERSITY

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XI'AN PETROLEUM UNIVERSITY
Filing Date
2026-04-09
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing PCB defect detection methods based on YOLOv11n lack accuracy in detecting defects with subtle structural changes, making it difficult to effectively model local details and global context information simultaneously. Furthermore, they struggle to meet the real-time requirements of industrial online inspection while maintaining a lightweight design.

Method used

An Adaptive Aligned Frequency Module (AAFM) is introduced, which performs spatial alignment and channel recalibration through cross-branch alignment units and utilizes complementary frequency fusion units for frequency domain decomposition and fusion to enhance feature representation. This module is integrated into the backbone network of YOLOv11n.

Benefits of technology

It significantly improves the stability and accuracy of multi-scale defect detection, especially the ability to characterize fine structural defects, while maintaining the model's lightweight nature and robustness in complex contexts, making it suitable for real-world industrial production environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122289236A_ABST
    Figure CN122289236A_ABST
Patent Text Reader

Abstract

This invention relates to the field of PCB defect detection technology and discloses a PCB defect detection method based on an adaptive alignment frequency module. The method includes the following steps: acquiring a PCB image to be detected; inputting the PCB image into a defect detection model, which includes a backbone network, a neck network, and a detection head; and using the backbone network to perform multi-level feature extraction on the PCB image, wherein the key feature extraction stage of the backbone network is... This invention effectively reduces semantic differences between features by using cross-branch alignment units to spatially align and recalibrate multi-scale features from different branches. This ensures that shallow and deep features achieve consistency in spatial position and channel response before fusion, thereby significantly improving the model's detection stability for PCB defects with large scale differences and avoiding missed and false detections caused by feature misalignment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of PCB defect detection technology, and in particular to a PCB defect detection method based on an adaptive alignment frequency module. Background Technology

[0002] Printed circuit boards (PCBs) are the most fundamental and critical interconnect carriers in electronic systems, and their manufacturing quality directly affects the reliability, stability, and lifespan of electronic products. As modern electronic manufacturing develops towards high density, miniaturization, and integration, PCB surface defects exhibit characteristics such as smaller target size, weaker edge texture, and more subtle differences between types, placing higher demands on the accuracy and real-time performance of defect detection systems.

[0003] Early PCB defect detection methods primarily relied on traditional image processing techniques, such as template matching, edge operators, and threshold segmentation. These methods are simple to implement and computationally efficient under controlled conditions, but their performance is highly dependent on manually designed features. When lighting conditions change, noise interferes, or there are slight image misalignments, detection performance significantly degrades, easily leading to false positives and false negatives. Furthermore, traditional methods struggle to effectively model complex textures and subtle defect morphologies, have limited generalization capabilities, and are ill-suited to the complex variations of real-world industrial production environments.

[0004] In recent years, with the development of deep learning technology, object detection methods based on convolutional neural networks have gradually become the mainstream for PCB defect detection. These methods can automatically learn multi-level semantic features from large-scale data and possess strong capabilities for representing complex structures. Among them, the YOLO series, due to its single-stage architecture and high inference speed, is widely used in industrial online inspection scenarios. YOLOv11, as one of the latest versions in this series, achieves a good balance between detection accuracy and computational efficiency. In particular, its lightweight variant, YOLOv11n, has advantages in model size and inference speed, making it suitable for deployment in edge devices and industrial control systems.

[0005] However, existing PCB defect detection methods based on YOLOv11n still have the following technical problems: 1. YOLOv11n mainly relies on spatial domain convolution for feature extraction. For defects such as "mouse bites", "protrusions" and "missing holes" that are characterized by subtle structural changes, conventional convolutional features have a weak response and are difficult to capture high-frequency structural information and subtle edge textures, resulting in limited detection accuracy.

[0006] 2. PCB defects vary greatly in scale, and single spatial domain features are difficult to effectively model local details and global context information at the same time, which affects the stability of the model in detecting multi-scale targets.

[0007] 2. Existing improvement methods mostly focus on enhancing spatial domain feature representation, such as introducing attention mechanisms and optimizing feature pyramids, but they fail to fully utilize frequency domain information to compensate for and enhance high-frequency details, which is a limitation.

[0008] 3. While some methods can improve detection accuracy, they often come with increased model complexity, making it difficult to meet the real-time requirements of industrial online detection while maintaining a lightweight design. Summary of the Invention

[0009] This invention provides a PCB defect detection method based on an adaptive alignment frequency module to solve existing technical problems, thereby addressing the issue of unstable detection of PCB defects with large scale differences, such as short circuits and open circuits.

[0010] To address the aforementioned technical problems, according to one aspect of the present invention, more specifically, a PCB defect detection method based on an adaptive alignment frequency module, comprising the following steps: Step S1: Obtain the PCB image to be inspected; Step S2: Input the PCB image into the defect detection model, which includes a backbone network, a neck network, and a detection head; Step S3: Use the backbone network to perform multi-level feature extraction on the PCB image. In the key feature extraction stage of the backbone network, the adaptive alignment frequency module is used to perform spatial alignment, channel alignment, frequency domain decomposition and complementary fusion on the input multi-scale features to obtain enhanced multi-scale features. Step S4: Use the neck network to perform feature fusion on the enhanced multi-scale features to obtain fused features; Step S5: Utilize the detection head to output the detection results of PCB defects based on the fusion features.

[0011] Furthermore, the adaptive frequency alignment module includes a cross-branch alignment unit and a complementary frequency fusion unit; The cross-branch alignment unit is used to spatially align and channel recalibrate the first and second input features from different branches to generate aligned features. After performing frequency domain transformation, frequency domain decomposition, and fusion processing on the aligned features using the complementary frequency fusion unit, the features are restored to the spatial domain, resulting in an enhanced feature representation.

[0012] Furthermore, generating aligned features using the cross-branch alignment unit includes calculating the spatial alignment features according to the following formula. and channel alignment features : ; ; In the above formula, This is the first input feature; This is the second input feature; For adaptive weights in the spatial dimension; Adaptive weights for the channel dimension; This indicates element-wise multiplication.

[0013] Furthermore, processing the aligned features using the complementary frequency fusion unit includes: Perform a two-dimensional fast Fourier transform on the aligned features to obtain the frequency domain spectrum; The frequency domain spectrum is decomposed into low-frequency structural components and high-frequency detail components using a central region masking strategy. The low-frequency structural components and the high-frequency detail components are weighted and fused using learnable fusion weights; The enhanced feature representation is obtained by performing a two-dimensional inverse Fourier transform on the fused frequency domain features.

[0014] Furthermore, the defect detection model uses YOLOv11n as the baseline model, and the standard C3k2 module in the backbone network is replaced with a C3k2-AAFM module that integrates the adaptive alignment frequency module.

[0015] Furthermore, the types of PCB defects include rodent bites, protrusions, missing holes, short circuits, open circuits, and excess copper.

[0016] Furthermore, before inputting the PCB image into the defect detection model, the resolution of the PCB image is uniformly adjusted to a preset size.

[0017] Furthermore, the defect detection model is trained through the following steps: Obtain a sample image set, which contains images labeled with PCB defect categories and locations; The sample image set is input into the defect detection model to calculate the classification loss and regression loss; The network parameters of the defect detection model are updated by backpropagation based on the classification loss and regression loss until the training stopping condition is met.

[0018] Furthermore, the detection results of PCB defects output by the detection head include the bounding box location information, category confidence level, and category label of each defect target.

[0019] This invention provides a PCB defect detection method based on an adaptive alignment frequency module. Compared with existing technologies, this method achieves the following advantages: 1. This invention performs spatial alignment and channel recalibration on multi-scale features from different branches through cross-branch alignment units, which effectively reduces the semantic differences between features and makes the spatial position and channel response of deep and shallow features consistent before fusion. This significantly improves the detection stability of the model for PCB defects (such as short circuits and open circuits) with large scale differences and avoids missed detections and false detections caused by feature misalignment.

[0020] 2. This invention utilizes complementary frequency fusion units to transform aligned features to the frequency domain, and employs a central region masking strategy to decompose them into low-frequency structural components and high-frequency detail components. After adaptive fusion using learnable weights, the features are restored to the spatial domain, thereby effectively compensating for the shortcomings of traditional spatial domain convolution in capturing subtle edges and texture information, and significantly enhancing the characterization ability of high-frequency detail-sensitive defects such as mouse bites, protrusions, and missing holes.

[0021] 3. While maintaining the lightweight parameter scale of YOLOv11n, this invention integrates the adaptive alignment frequency module into the key feature extraction stage of the backbone network, achieving a comprehensive improvement in detection accuracy without introducing complex additional branches or significantly increasing the computational load.

[0022] 4. This invention decomposes and weights the low-frequency structural components and high-frequency detail components of the frequency domain spectrum, enabling the model to dynamically adjust the degree of attention to global contour semantics and local defect texture. Thus, it maintains robust detection capability for different types of PCB defects even under complex backgrounds such as changes in illumination, noise interference, or slight image misalignment, effectively improving adaptability in actual industrial production environments. Attached Figure Description

[0023] Figure 1 This is a diagram of the overall network structure of the present invention; Figure 2 This is a schematic diagram of the AAFM module of the present invention. Detailed Implementation

[0024] To make the technical solution of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Example 1

[0025] like Figure 1 As shown, according to one aspect of the present invention, a PCB defect detection method based on an adaptive alignment frequency module is provided, the overall network structure of which is as follows: Figure 1As shown, this method uses YOLOv11n as the baseline model, retaining its original backbone network, neck network, and detection head structure to maintain training efficiency and deployment convenience. The main improvement lies in replacing the original C3k2 module in the key feature extraction stage of the backbone network with an improved C3k2-AAFM module. This module integrates an Adaptive Alignment Frequency Module (AAFM), which achieves cross-scale feature alignment and frequency domain compensation in the early and middle stages of feature formation, thereby enhancing the model's ability to represent multi-scale defects, especially subtle and structural defects.

[0026] I. AAFM Module Structure, wherein the AAFM module is the core of this invention, and its structure is as follows: Figure 2 As shown, this module consists of two key components: a cross-branch alignment unit and a complementary frequency fusion unit.

[0027] 1. A cross-branch alignment unit, which processes input features from different branches and reduces semantic differences through spatial alignment and channel recalibration. Specifically, generating aligned features using the cross-branch alignment unit includes calculating the spatially aligned features according to the following formula. and channel alignment features : ; ; In the above formula, This is the first input feature; This is the second input feature; For adaptive weights in the spatial dimension; Adaptive weights for the channel dimension; This indicates element-wise multiplication.

[0028] 2. Complementary Frequency Fusion Unit: This unit enhances subtle edge and texture responses that are difficult to preserve in spatial convolution. First, the aligned feature maps... and By performing fusion, fusion characteristics are obtained. Subsequently, on Perform a two-dimensional Fast Transform (FFT) to project the vector from the spatial domain to the frequency domain, obtaining the frequency domain representation. : ; Using the central area masking strategy The feature is decomposed into low-frequency structural components and high-frequency detail components. The low-frequency components are used to preserve the global contour and semantic layout, while the high-frequency components are used to enhance edge strength and local defect texture. The two decomposed components are recalibrated using learnable fusion weights and then restored to the spatial domain using inverse Fourier transform (IFFT) to obtain the final enhanced feature representation.

[0029] II. Experimental Verification and Results To verify the effectiveness of this invention, the inventors conducted experiments on a publicly available PCB defect dataset. The dataset contains 8002 images, covering six types of defects. The experimental environment configuration is shown in Table 1: Table 1 Experimental Environment Configuration Parameters 1. Category Performance Comparison To verify the improvement effect of the AAFM module on different defect types, the performance of the method of this invention was first compared with the baseline model YOLOv11n on six defect types, and the results are shown in Table 2. Experimental results show that the method of this invention outperforms the baseline model in precision (P), recall (R), and mean precision (mAP@0.5) on all six defect types. In particular, the performance improvement is more significant on defects that rely on subtle edge and texture information, such as "mouse bites," "protrusions," and "holes," demonstrating the effective enhancement of the frequency domain complementary fusion mechanism for high-frequency feature representation.

[0030] Table 2 Comparison of Performance Parameters 2. Overall performance comparison To further evaluate the overall performance of the method of this invention, it was compared with ten mainstream target detection models (including two-stage detectors, classic single-stage detectors, and lightweight YOLO variants), and the results are shown in Table 3. Experimental results show that the method of this invention achieves the best values ​​in precision, recall, mAP@0.5, and mAP@0.5:0.95, reaching 98.2%, 97.7%, 98.9%, and 57.1%, respectively. Furthermore, while maintaining a lightweight parameter scale, the method of this invention achieves more stable multi-scale defect detection performance and superior overall efficiency.

[0031] Table 3 Comparison of Overall Performance Parameters In summary, this invention provides a PCB defect detection method based on an adaptive alignment frequency module. By introducing the AAFM module, it achieves effective alignment and fusion of multi-scale features in both the spatial and frequency domains, significantly improving the model's ability to detect minute and structural defects on the PCB surface. Experimental data fully demonstrate that this method outperforms existing technologies in both detection accuracy and real-time performance, making it suitable for online PCB defect detection in real-world industrial scenarios.

[0032] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.

Claims

1. A PCB defect detection method based on an adaptive alignment frequency module, characterized in that, Includes the following steps: Step S1: Obtain the PCB image to be inspected; Step S2: Input the PCB image into the defect detection model, which includes a backbone network, a neck network, and a detection head; Step S3: Use the backbone network to perform multi-level feature extraction on the PCB image. In the key feature extraction stage of the backbone network, the adaptive alignment frequency module is used to perform spatial alignment, channel alignment, frequency domain decomposition and complementary fusion on the input multi-scale features to obtain enhanced multi-scale features. Step S4: Use the neck network to perform feature fusion on the enhanced multi-scale features to obtain fused features; Step S5: Utilize the detection head to output the detection results of PCB defects based on the fusion features.

2. The PCB defect detection method based on an adaptive alignment frequency module according to claim 1, characterized in that: The adaptive alignment frequency module includes a cross-branch alignment unit and a complementary frequency fusion unit; The cross-branch alignment unit is used to spatially align and channel recalibrate the first and second input features from different branches to generate aligned features. After performing frequency domain transformation, frequency domain decomposition, and fusion processing on the aligned features using the complementary frequency fusion unit, the features are restored to the spatial domain, resulting in an enhanced feature representation.

3. The PCB defect detection method based on an adaptive alignment frequency module according to claim 2, characterized in that: Generating aligned features using the cross-branch alignment unit includes calculating the spatial alignment features according to the following formula. and channel alignment features : ; ; In the above formula, This is the first input feature; This is the second input feature; For adaptive weights in the spatial dimension; Adaptive weights for the channel dimension; This indicates element-wise multiplication.

4. The PCB defect detection method based on an adaptive alignment frequency module according to claim 2, characterized in that: Processing the aligned features using the complementary frequency fusion unit includes: Perform a two-dimensional fast Fourier transform on the aligned features to obtain the frequency domain spectrum; The frequency domain spectrum is decomposed into low-frequency structural components and high-frequency detail components using a central region masking strategy. The low-frequency structural components and the high-frequency detail components are weighted and fused using learnable fusion weights; The enhanced feature representation is obtained by performing a two-dimensional inverse Fourier transform on the fused frequency domain features.

5. The PCB defect detection method based on an adaptive alignment frequency module according to claim 1, characterized in that: The defect detection model uses YOLOv11n as the baseline model, and the standard C3k2 module in the backbone network is replaced with a C3k2-AAFM module that integrates the adaptive alignment frequency module.

6. The PCB defect detection method based on an adaptive alignment frequency module according to claim 1, characterized in that: The types of PCB defects include rodent bites, protrusions, missing holes, short circuits, open circuits, and excess copper.

7. The PCB defect detection method based on an adaptive alignment frequency module according to claim 1, characterized in that: Before inputting the PCB image into the defect detection model, the resolution of the PCB image is uniformly adjusted to a preset size.

8. The PCB defect detection method based on an adaptive alignment frequency module according to claim 1, characterized in that: The defect detection model is trained through the following steps: Obtain a sample image set, which contains images labeled with PCB defect categories and locations; The sample image set is input into the defect detection model to calculate the classification loss and regression loss; The network parameters of the defect detection model are updated by backpropagation based on the classification loss and regression loss until the training stopping condition is met.

9. The PCB defect detection method based on an adaptive alignment frequency module according to claim 1, characterized in that: The detection results of PCB defects output by the detection head include the bounding box location information, category confidence level, and category label of each defect target.