A method and system for detecting PCB solder joint defects
By constructing frequency division semantics and adaptive suppression factors based on the red-blue structured light imaging mechanism, the problems of high false alarm rate and weak generalization ability in the existing technology of solder joint defect detection are solved, and high-precision solder joint defect detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 湖南工商大学
- Filing Date
- 2026-05-26
- Publication Date
- 2026-07-31
AI Technical Summary
Existing solder joint defect detection methods based on pure visual convolutional neural networks ignore the decoupling between the physical optical imaging mechanism and multi-frequency domain morphological semantics behind solder joint images. They cannot effectively distinguish between visually similar but physically different solder joint defects, and lack an adaptive positive and negative contrast constraint mechanism, resulting in a high false alarm rate and weak generalization ability.
We construct a frequency-division semantic based on the red-blue structured light imaging mechanism, and decouple the physical semantics of multiple frequency domains and impose positive and negative contrast constraints through frequency-division gating weights and adaptive suppression factors. Combined with spatial attention mechanism, we optimize the extraction and recognition of solder joint features.
It significantly improves the discrimination and robustness of weld joint defect detection, reduces the false alarm rate, enhances the model's generalization ability under complex lighting and long-tailed distributions, and achieves high-precision weld joint defect detection.
Smart Images

Figure CN122265282B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of solder joint defect detection technology, specifically a PCB solder joint defect detection method and system. Background Technology
[0002] With the rapid development of electronic manufacturing services and surface mount technology, automated optical inspection systems have gradually become a core component in ensuring PCB product quality. Deep learning-based target detection algorithms, driven by data, can automatically extract image features and locate defects. However, existing detection methods based on purely visual convolutional neural networks neglect the decoupling between the physical optical imaging mechanisms and multi-frequency domain morphological semantics behind solder joint images.
[0003] In real-world industrial scenarios, the visual representation of solder joint defects is typically formed by mapping specific three-dimensional shapes under red and blue structured light. Defects and good products exhibit extremely similar visual textures but have drastically different physical definitions. Simple pixel-level feature extraction cannot fully depict this mapping relationship between color, height, shape, and texture and structure. Existing technologies often mix high-frequency information (such as edges and noise) with low-frequency information (such as color blocks and structures), making it difficult for models to distinguish visually similar but physically different targets. For example, high-frequency board surface dust may be misidentified as solder splatter, or low-frequency pad reflections may be misidentified as missing components.
[0004] Furthermore, many complex boundary features between good and defective products remain to be captured, and current technologies lack explicit adaptive mechanisms to suppress the activation of good product features. Typically, fixed thresholds or feature extraction methods are used, failing to dynamically adjust the suppression of background noise based on the difficulty of the defect, resulting in a persistently high false positive rate under complex lighting conditions. Finally, traditional neural networks have many shortcomings when dealing with small sample defects with long-tailed distributions. For example, they struggle to extract robust discriminative features from a single-digit number of samples through simple convolution operations, limiting the model's generalization ability and efficiency. Due to their powerful fitting ability, neural networks may overfit on a limited number of defect samples, leading to decreased generalization ability in unseen complex lighting scenarios. Moreover, black-box models result in poor interpretability of detection results.
[0005] In conclusion, a new technical solution for detecting PCB solder joint defects is urgently needed. Summary of the Invention
[0006] The purpose of this application is to provide a PCB solder joint defect detection method and system to solve the following technical problems existing in the prior art: simple pure vision deep learning models, when applied to PCB solder joint defect detection, ignore fine-grained morphological semantics based on physical optics, and cannot distinguish between high-frequency texture defects and low-frequency structural defects through frequency domain decoupling; visually similar but physically different difficult defects cannot be effectively distinguished; the complex feature overlap between good products and defects is not explicitly compared and suppressed, and there is a lack of adaptive positive and negative contrast constraint mechanism, resulting in a high false alarm rate in industrial inspection; traditional neural networks have many shortcomings in processing small sample and long-tailed defect features, resulting in weak generalization ability and a lack of decision interpretability based on physical semantics.
[0007] To achieve the above objectives, this application provides a method for detecting PCB solder joint defects, including: Frequency division semantics based on PCB solder joints, including high-frequency texture semantics, low-frequency structural semantics, and good product background semantics, and preset suppression factors for suppressing good product background of PCB solder joints, are used to construct frequency division gating weights including high-frequency texture gating weights and low-frequency structural gating weights. The preprocessed PCB image to be inspected is decoupled by frequency division to obtain the original solder joint features, including the original high-frequency texture features and the original low-frequency texture features. Based on frequency division gate weights and combined with residual connections, the original solder joint features are updated to obtain optimized solder joint features, including optimized high-frequency texture features and optimized low-frequency texture features. Image recognition is performed based on optimized solder joint features to obtain solder joint defects in the PCB image to be detected, and a loss function is calculated to update the suppression factor, thereby updating the frequency division gating weight.
[0008] Preferably, the frequency division semantics specifically involves transforming the physical description of solder joint defects into a feature vector. This transformation process includes: Based on the red-blue structured light imaging mechanism, three mutually exclusive semantic description sets are constructed, including a high-frequency texture set describing defects such as edge abrupt changes or complex textures, a low-frequency structure set describing defects such as geometric deformations or large-area color blocks, and a negative suppression set describing good product features and background interference. Feature extraction is performed on each semantic description set, and the result of the feature extraction is averaged to obtain the corresponding high-frequency texture semantics, low-frequency structure semantics, and good quality background semantics.
[0009] Preferably, the construction of the frequency division gate weights includes: Based on a pre-defined linear layer, frequency division semantics are mapped to the visual channel; Based on the frequency division semantics mapped to the visual channel, and combined with the suppression factor, the frequency division guidance vector is calculated; wherein, the frequency division guidance vector includes high-frequency texture guidance vector and low-frequency structure guidance vector; Based on the frequency division guiding vector, combined with a preset transformation function, the numerical value is obtained in... Frequency division gating weights within the interval.
[0010] Preferably, the calculation of the frequency division guiding vector includes: The high-frequency texture guiding vector is calculated using the formula for calculating the high-frequency texture guiding vector; specifically, the formula for calculating the high-frequency texture guiding vector is as follows: in: High-frequency texture guiding vector; This represents high-frequency texture semantics mapped to the visual channel; As an inhibitor, Indicates will The numerical limit is within interval; This represents the semantic meaning of the good product background mapped to the visual channel; The low-frequency structure-guided vector is calculated using the formula for calculating the low-frequency structure-guided vector; specifically, the formula for calculating the low-frequency structure-guided vector is as follows: in: This is a low-frequency structure guiding vector; This represents the low-frequency structural semantics mapped to the visual channel.
[0011] Preferably, the updated original solder joint features include: The original high-frequency texture features are updated using a high-frequency texture feature update formula to obtain optimized high-frequency texture features; the specific high-frequency texture feature update formula is as follows: in: To optimize high-frequency texture features; These are the original high-frequency texture features; For high-frequency texture gating weights; The original low-frequency structural features are updated using a low-frequency structural feature update formula to obtain optimized low-frequency structural features; the specific low-frequency structural feature update formula is as follows: in: To optimize low-frequency structural characteristics; This represents the original low-frequency structural characteristics; For low-frequency structure gating weights.
[0012] Preferably, the preprocessing of the PCB image to be detected includes: Extract the original multi-scale feature map of the PCB image to be inspected; After filtering key feature channels in the original multi-scale feature map using channel attention, the first multi-scale feature map is output. A saliency mask is generated by spatial attention, and a focused feature map is output by combining the original multi-scale feature map and the first multi-scale feature map. This focused feature map focuses on the PCB solder joint area in the PCB image to be detected.
[0013] Preferably, the frequency division decoupling includes: The original low-frequency texture features are extracted by simulating a low-pass filter using average pooling. These original low-frequency texture features include the color distribution of solder joints and the overall structural information of the solder joints. The original high-frequency texture features are extracted using the difference method. These original high-frequency texture features include the edges of the solder joints and the texture details of the solder joints.
[0014] Preferably, the method of image recognition based on optimized solder joint features to obtain solder joint defects in the PCB image to be detected specifically involves: splicing optimized solder joint features, performing dimensionality reduction and fusion through a preset convolutional layer to generate a final feature map; and performing image recognition based on the final feature map to obtain solder joint defects including the position of the solder joint bounding box and the probability of the defect category. The calculation of the loss function to update the suppression factor specifically involves: calculating and recording the total loss function during the recognition process of the final feature map, and updating the suppression factor based on the gradient of the recorded total loss function.
[0015] Preferably, the method of updating the suppression factor based on the gradient of the total loss function of the record specifically involves: Set the initial value corresponding to the inhibition factor; When visual features are located in the overlapping region of positive and negative samples in the semantic space, the initial value is increased based on the gradient feedback of the loss function. When visual features are not located in the overlapping region of positive and negative samples in the semantic space, gradient feedback based on the loss function reduces the initial value.
[0016] To achieve the above objectives, this application also provides a PCB solder joint defect detection system, which applies the PCB solder joint defect detection method described above, including: The frequency division gating weight construction module is used to construct frequency division gating weights, including high-frequency texture semantics, low-frequency structural semantics and good product background semantics, based on the frequency division semantics of PCB solder joints, as well as the preset suppression factor for suppressing the good product background of PCB solder joints. The original feature decoupling module is used to perform frequency division decoupling on the preprocessed PCB image to be detected, and obtain the original solder joint features including the original high-frequency texture features and the original low-frequency texture features; The frequency division optimization feature module is used to update the original solder joint features based on the frequency division gate weights and combined with residual connections, so as to obtain optimized solder joint features including optimized high-frequency texture features and optimized low-frequency texture features. The defect detection and update module is used to perform image recognition based on optimized solder joint features, obtain solder joint defects in the PCB image to be detected, and calculate the loss function to update the suppression factor, thereby updating the frequency division gating weight.
[0017] Beneficial effects: The PCB solder joint defect detection method and system proposed in this application propose a PCB solder joint defect detection method based on fine-grained morphological semantic guidance and positive and negative contrast constraints. It deeply integrates multi-frequency domain physical semantics, spatial attention mechanism and single-stage target detection network, endowing the model with the ability to understand the cause of defects in the physical frequency domain, realizing orthogonal guidance for finding textures at high frequency and finding structures at low frequency, and significantly improving the model's ability to distinguish difficult defects. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 A flowchart illustrating the PCB solder joint defect detection method provided in this application embodiment; Figure 2 A flowchart illustrating the process of converting a physical description of a solder joint defect into a feature vector, as provided in an embodiment of this application. Figure 3 A flowchart illustrating the construction of frequency division gating weights provided in this application embodiment; Figure 4 A flowchart illustrating the preprocessing of a PCB image to be inspected, provided in an embodiment of this application. Figure 5 A flowchart illustrating frequency division decoupling provided in an embodiment of this application; Figure 6 The diagram shows the structural block diagram of the PCB solder joint defect detection system provided in the embodiments of this application; in the diagram: 10, frequency division gating weight construction module; 20, original feature decoupling module; 30, frequency division optimization feature module; 40, defect detection and updating module.
[0020] The implementation, functional features, and advantages of this invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0021] The technical solutions in the embodiments of this application will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0022] In this document, the term "comprising" is intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0023] The terminology used in this embodiment will now be explained.
[0024] Multi-frequency morphological decoupling gating, a core neural network component proposed in this embodiment, is implanted between the neck and head of the object detection network. It integrates spatial attention mechanism and frequency domain signal processing principle, and can decompose the input visual features into high-frequency texture components and low-frequency structural components in the physical dimension. Then, it uses the corresponding semantic prototypes for orthogonal guidance, and finally outputs the results through cross-domain fusion, thereby realizing physical semantic-driven detection.
[0025] Frequency domain feature decoupling is introduced in this embodiment through a signal processing-based feature extraction mechanism. Average pooling is used to simulate a low-pass filter to extract the image's color and overall geometric structure (defined as low-frequency information, corresponding to defects such as missing parts and holes). The difference between the original features and the low-frequency components is used to extract edge gradients and fine textures (defined as high-frequency information, corresponding to defects such as solder brittleness and sharpening). This aims to solve the problem of feature confusion due to different physical causes of defects in traditional convolutional networks.
[0026] This embodiment proposes a dynamic feature correction mechanism based on adaptive positive-negative contrast constraints. Building upon traditional positive enhancement and negative suppression, a learnable adaptive suppression factor is introduced to calculate gating weights. This allows the mechanism to automatically find the optimal deduction strength for good features based on gradient feedback during training, thereby maximizing the reduction of false positives while maintaining recall.
[0027] An adaptive suppression factor, defined in this embodiment, is a learnable parameter used to control the suppression strength of negative good product semantics on visual features. Unlike a fixed threshold, this parameter is automatically updated during network training. For easily confused defects (such as minor solder bleeds), a larger suppression factor is automatically learned. The value is used to enhance the filtering of background noise; for defects with obvious features, a smaller value is learned. Values are kept to preserve details.
[0028] Red-blue structured light imaging is a core imaging technology in automated optical inspection. It uses colored light at different angles to illuminate an object, converting three-dimensional height information into two-dimensional color information. This embodiment utilizes this principle to construct frequency-division semantics: low-frequency features, such as high-angle red light corresponding to flat areas, and high-frequency features, such as low-angle blue light corresponding to sloping areas. The method in this embodiment decouples visual features based on this physical law.
[0029] The application scenarios of this embodiment will now be described.
[0030] The reliability level of core basic components is a crucial indicator of the development level of the manufacturing industry. Implementing quality reliability improvement plans and enhancing the reliability level of electronic components are key measures to promote quality upgrades. As a core foundation of manufacturing, the quality of components directly determines the performance and safety of complete equipment, and their detection accuracy and efficiency have become significant bottlenecks restricting the manufacturing industry's advancement towards the mid-to-high end. Against this backdrop, relying on image anomaly recognition technology to achieve accurate classification and location of component defects is of great practical significance for strengthening the quality foundation of the manufacturing industry and enhancing the resilience of the industrial and supply chains. In the modern electronics manufacturing services industry, printed circuit boards (PCBs), as the core carrier of electronic products, directly determine the reliability and lifespan of the final product through their assembly quality. With the rapid development of surface mount technology towards miniaturization and high density, solder joint defect detection has become a crucial link in production quality control.
[0031] Current automated optical inspection systems primarily employ imaging technologies based on red-blue structured light or multi-angle light sources, using cameras to acquire and analyze solder joint images. Existing detection algorithms are mainly divided into two categories: one is traditional machine vision algorithms, which rely on manually designed features, such as color thresholds, geometric shapes, and brightness histograms, for logical judgment; the other is the emerging deep learning-based object detection algorithms, such as the YOLO series, Faster R-CNN, and SSD, which automatically extract image features for classification and localization through convolutional neural networks.
[0032] With the popularization of artificial intelligence technology, deep learning-based methods have gradually replaced traditional algorithms as the mainstream due to their powerful feature extraction capabilities. These methods, trained on large-scale labeled datasets, can identify common solder joint defects, such as insufficient solder, excessive solder, and misalignment, thus improving the automation level and efficiency of inspection to a certain extent.
[0033] Chinese patent application CN119722611A proposes an industrial defect detection method based on anomaly cue learning, addressing the lack of abnormal samples in the industry. It utilizes CLIP to extract features from normal samples, then derives / designs anomaly cuees through semantic connections, and finally performs detection based on explicit anomaly boundaries. This technique focuses on defining anomalies through negative derivation from normal samples, lacking positive semantic descriptions of specific defect physical features such as shape, texture, and edges. Chinese patent application CN118505608A proposes a combined supervised and unsupervised industrial product defect detection method. It first uses YOLO to extract the ROI, then uses an unsupervised algorithm to determine its quality. This technique employs a cascaded architecture, preventing interaction between front-end and back-end features and failing to utilize semantic priors to guide the YOLO network to focus on defect areas during feature extraction. Chinese patent CN119559175B proposes an anomaly defect detection method and system applied to intelligent soldering of PCB boards. This technology relies on non-visual sensors and manually designed low-level features, making it unable to handle defects with complex and varied appearances. Chinese patent application CN120013868A proposes a method for detecting PCB board anomalies based on template image registration and alignment. This technique registers and aligns the PCB board image to be detected with the PCB template image. By comparing edge energy, one or more potential anomaly regions of the PCB board image to be detected are obtained. A metric model is used to compare the potential anomaly regions with the corresponding coordinate frame regions of the PCB template image. The anomaly state is confirmed by the comparison results. This method is sensitive to ambient lighting and mechanical positioning errors, which may lead to a high false alarm rate.
[0034] Based on the analysis of existing AOI detection technologies and general object detection algorithms, the existing technologies have the following shortcomings: First, they lack the ability to decouple and understand the semantics of physical morphology in multiple frequency domains. Existing deep learning detection models, such as the standard YOLOv8, are essentially black-box models based on pixel statistical features, and often mix high-frequency information (texture, edges) with low-frequency information (color, structure) in the feature extraction process. This ignores the different frequency domain characteristics of solder joint defects under red and blue structured light. For example, solder blasting defects mainly manifest as high-frequency jagged texture noise, while missing components or missing leads manifest as low-frequency flat color blocks or structural defects. Existing pure vision models struggle to accurately capture these two distinct types of features simultaneously in a mixed feature space, easily leading to the phenomenon of misjudging high-frequency impurities in the background as solder blasting or ignoring low-frequency structural anomalies. Second, the boundaries between positive and negative sample features are blurred, and the suppression mechanism lacks adaptability. In industrial PCB inspection scenarios, good solder joints account for the vast majority, and their background features are easily confused with minor defects. While existing technologies attempt to introduce negative sample suppression, they typically employ fixed suppression parameters, failing to dynamically adjust based on the complexity of the defects. This results in the model's inability to automatically find the optimal feature subtraction strength when faced with genuine and false defects exhibiting extremely similar features, making it difficult to achieve both high recall and extremely low false positive rates. Furthermore, spatial awareness is weak, making it susceptible to interference from complex backgrounds. Existing detection algorithms often directly extract features from the entire image, lacking a prior spatial attention mechanism. In areas with complex PCB traces and abundant silkscreen text interference, the model easily introduces background noise into the subsequent semantic matching process, leading to semantic guidance failure. Finally, learning from the extremely few samples in a long-tailed distribution is challenging. In actual production, there are many typical defect samples, but very few difficult defect samples. Traditional neural networks rely on massive amounts of data; when faced with such an extremely long-tailed distribution, it is difficult to learn robust feature representations through simple convolution operations, resulting in a high false negative rate and poor generalization ability. The PCB solder joint defect detection method and system proposed in this embodiment address this challenge.
[0035] In terms of technical solution, this embodiment proposes a PCB solder joint defect detection technology based on fine-grained morphological semantic guidance and positive-negative contrast constraints. It creatively integrates multi-frequency domain physical semantics, spatial attention mechanisms, and a single-stage target detection network. First, based on the physical principles of red-blue structured light imaging, this embodiment constructs an offline morphological semantic knowledge base with frequency-division descriptions, decoupling defect features into high-frequency texture descriptions and low-frequency structural descriptions. Subsequently, a gating mechanism to achieve multi-frequency morphological decoupling is designed and embedded in the detection network. This gating mechanism first preprocesses visual features using a convolutional block attention mechanism to filter out background noise; then, it uses signal processing principles to physically decompose the feature map into orthogonal high-frequency and low-frequency components. Based on this, an adaptive positive-negative contrast constraint mechanism is introduced, using an automatically learnable inhibition factor to dynamically calculate the similarity between image features and positive defect semantics and negative good product semantics. Through the high-frequency semantic texture finding, low-frequency semantic structure finding, and adaptive feature correction strategy of subtracting good products designed in this embodiment, accurate detection driven by physical semantics is achieved. Finally, by combining a hybrid data augmentation and loss function strategy optimized for long-tail distributions, the final defect detection results are output. This significantly improves the model's accuracy and robustness in identifying minute and difficult-to-identify weld defects in complex industrial scenarios.
[0036] In terms of technical effectiveness, this embodiment introduces a fine-grained physical optics description based on frequency domain decoupling, solving the problem of low recognition caused by feature mixing in existing technologies. It overcomes the limitations of traditional models that confuse texture with structure, endowing the detection model with divide-and-conquer capabilities through multi-frequency morphological decoupling. Finally, experiments demonstrate that this embodiment can effectively distinguish between complex high-frequency defects and regular low-frequency defects. This orthogonal guidance mechanism significantly reduces the confusion rate between different types of defects. The established adaptive positive-negative contrast constraint mechanism achieves intelligent dynamic suppression of good-quality features. By introducing a learnable adaptive suppression factor, the model automatically finds the optimal subtraction strength for good-quality features during training. This automatically suppresses areas that, although reflective, conform to good-quality features, effectively eliminating high-frequency noise interference such as dust. By leveraging CBAM (Convolutional Block Attention Module) spatial focusing (i.e., convolutional block attention mechanism) and CLIP (Contrastive Language-Image Pre-training) general visual knowledge, along with a hybrid data augmentation strategy, the generalization ability for extremely long-tailed small sample defects is enhanced, making up for the problem of insufficient training data for some rare defects in industrial datasets.
[0037] The PCB solder joint defect detection method of this embodiment will now be described in detail.
[0038] Reference Figure 1 , Figure 1 This is a flowchart illustrating the PCB solder joint defect detection method provided in an embodiment of this application.
[0039] Firstly, such as Figure 1 As shown, this embodiment discloses a method for detecting PCB solder joint defects, including: S10: Based on the frequency division semantics of PCB solder joints, including high-frequency texture semantics, low-frequency structural semantics and good product background semantics, and the preset suppression factor for suppressing the good product background of PCB solder joints, construct frequency division gating weights including high-frequency texture gating weights and low-frequency structural gating weights.
[0040] In the specific application of this embodiment, a frequency-division morphological semantic prototype library based on the principles of optical path physics was constructed. This process is based on the principle of red-blue structured light imaging, constructing three sets of semantic descriptions: high-frequency texture, low-frequency structure, and negative good product. Features are extracted using the CLIP model and aggregated to generate corresponding semantic prototype vectors, i.e., frequency-division semantics.
[0041] Reference Figure 2 , Figure 2 This is a flowchart illustrating the process of converting a physical description of a solder joint defect into a feature vector, as provided in an embodiment of this application.
[0042] Specifically, such as Figure 2 As shown, the frequency division semantics specifically involves transforming the physical description of solder joint defects into a feature vector. This transformation process includes: A11: Based on the red-blue structured light imaging mechanism, three mutually exclusive semantic description sets are constructed, including a high-frequency texture set describing defects such as edge abrupt changes or complex textures, a low-frequency structure set describing defects such as geometric deformations or large-area color blocks, and a negative suppression set describing good product features and background interference. A12: Extract features from each semantic description set, and perform average pooling on the results of the feature extraction to obtain the corresponding high-frequency texture semantics, low-frequency structure semantics, and good quality background semantics.
[0043] In this specific application, based on the red-blue structured light imaging mechanism—that is, color represents gradient and texture represents state—three mutually exclusive semantic description sets are constructed, and the semantic description sets are defined. It is divided into three parts: high-frequency texture set Describes defects such as abrupt edge changes or complex textures; low-frequency structure sets Describes geometric deformations or large areas of color; negative suppression set Describe the characteristics of good products and background interference.
[0044] Text encoder using CLIP model Feature extraction. For semantic description sets The first in Description Encoding and L2 normalization are performed to define it as The mathematical expression for this definition is: in, To represent the L2 norm, normalization ensures that the feature vectors are distributed on a unit hypersphere, facilitating subsequent calculation of cosine similarity. This is the standard processing method for the CLIP model. To eliminate noise from a single description, features within the same set are normalized. The description vectors are average pooled to generate three baseline prototype tensors of dimension 1×512, and the corresponding mathematical expressions are: The final output is high-frequency texture semantics. Low-frequency structural semantics He Liangpin Background Semantics .
[0045] Reference Figure 3 , Figure 3 A flowchart illustrating the construction of frequency division gating weights provided in this application embodiment.
[0046] Specifically, such as Figure 3 As shown, the construction of the frequency division gating weights includes: A21: Based on a preset linear layer, frequency division semantics are mapped to the visual channel.
[0047] In the specific application of this embodiment, due to semantic prototypes Since the dimensions of the visual feature channels are inconsistent, a pre-defined, learnable linear layer is used. Mapping semantic prototypes to the visual channel dimension, the corresponding mathematical expression is: in: , and These are the transposes of the learnable linear projection matrices corresponding to high-frequency, low-frequency, and negative suppression semantics, respectively. Their function is to map the high-dimensional text semantic space to the visual features. Figure 1 A consistent channel dimension space enables mathematical alignment of cross-modal features; This represents the projected positive high-frequency semantic guidance vector, which represents the ideal feature distribution of texture defects such as solder blasting and solder spikes as expected by the model after dimension alignment. This represents the projected positive low-frequency semantic guidance vector, which represents the ideal feature distribution of structural defects such as missing parts and holes expected by the model. This represents the negative semantic guidance vector for good products after projection, which represents the feature distribution of good solder joints or background interference (such as pad reflection).
[0048] Based on this, semantic projection alignment is completed.
[0049] A22: Based on the frequency division semantics mapped to the visual channel, and combined with the suppression factor, the frequency division guidance vector is calculated; where the frequency division guidance vector includes high-frequency texture guidance vector and low-frequency structure guidance vector.
[0050] In this specific application, an automatically updated inhibition factor is introduced during network training. Calculate the frequency division guiding vector.
[0051] Specifically, the calculation of the frequency division guiding vector includes: The high-frequency texture guiding vector is calculated using the formula for calculating the high-frequency texture guiding vector; specifically, the formula for calculating the high-frequency texture guiding vector is as follows: in: High-frequency texture guiding vector; This represents high-frequency texture semantics mapped to the visual channel; As an inhibitor, Indicates will The numerical limit is within interval; This represents the semantic meaning of the good product background mapped to the visual channel; The low-frequency structure-guided vector is calculated using the formula for calculating the low-frequency structure-guided vector; specifically, the formula for calculating the low-frequency structure-guided vector is as follows: in: This is a low-frequency structure guiding vector; This represents the low-frequency structural semantics mapped to the visual channel.
[0052] Based on this, adaptive difference calculation is performed to realize the logic of retaining defective features and deducting good features. That is, when the visual features are in the overlapping region of positive and negative samples in the semantic space (i.e., the region prone to false alarms), the model increases through gradient feedback. To enhance the differential constraint on background pseudo-features; when features have high discriminative power, the model automatically reduces... To preserve the original physical details to the greatest extent possible.
[0053] A23: Based on the frequency division guiding vector, combined with the preset transformation function, the numerical value is obtained in... Frequency division gating weights within the interval.
[0054] In this specific application, the frequency division guiding vector is transformed using the Sigmoid function. The probability weights of the intervals are expressed mathematically as follows: in: This represents the high-frequency semantic gating weight, which indicates the probability strength of each feature channel in the image belonging to a texture-type defect (such as solder blasting). This represents the low-frequency semantic gating weight, which indicates the probability strength of image features belonging to structural defects (such as missing parts or holes).
[0055] Based on this, the calculated gating weights, which are nonlinear activations and residual reconstructions of the original frequency domain components, complete the physical implementation of semantic guidance.
[0056] S20: Perform frequency division and decoupling on the preprocessed PCB image to be inspected to obtain the original solder joint features, including the original high-frequency texture features and the original low-frequency texture features.
[0057] In the specific application of this embodiment, the preprocessing of the PCB image to be inspected aims to obtain a focused feature map focusing on the PCB solder joint area in the PCB image to be inspected.
[0058] Reference Figure 4 , Figure 4 This is a flowchart illustrating the preprocessing of a PCB image to be detected, as provided in an embodiment of this application.
[0059] Specifically, such as Figure 4 As shown, the preprocessing of the PCB image to be detected includes: B1: Extract the original multi-scale feature map of the PCB image to be detected; B2: After filtering key feature channels in the original multi-scale feature map through channel attention, output the first multi-scale feature map; B3: Generate a saliency mask through spatial attention, combine the original multi-scale feature map and the first multi-scale feature map, and output a focused feature map that focuses on the PCB solder joint area in the PCB image to be detected.
[0060] In this specific application, the PCB to be inspected is input into the YOLOv8 backbone network, and feature maps at three scales are extracted. ,in, The original multi-scale feature map is the key information (such as edges, color blocks, textures, etc.) extracted from the PCB image through the YOLOV8 backbone network. Representing three-dimensional space, It is the number of channels. It is the height of the feature map. It is the width of the feature map.
[0061] To prevent semantic guidance from being interfered with by the background, preprocessing is performed using the CBAM mechanism before multi-frequency morphological decoupling is executed on the original multi-scale feature maps, including: The mathematical expression for filtering key feature channels using channel attention is: in: Represents the original multi-scale feature map of the input. The global average pooling operation is performed to aggregate global background information in the spatial dimension and extract the average statistical features of each channel. This means that the feature vector after average pooling is input into a multilayer perceptron for nonlinear mapping to learn the interdependencies between channels and predict the importance weight of each channel; Represents the original multi-scale feature map of the input. The global max pooling operation is performed to extract the most significant feature information in the spatial dimension (such as edges, tips, etc.) to supplement the key discriminative information that average pooling may ignore. This means that the max-pooled feature vector is input into the same shared multilayer perceptron mentioned above, and the learned parameters are used to map the channel weights of the most salient features. The Sigmoid activation function maps the summed channel feature response values to... Intervals are used to generate normalized probability weights; This represents the generated channel attention mapping vector, whose value represents the contribution or importance of different feature channels in the current detection task, and is used for subsequent weighted filtering of feature maps.
[0062] Then, a saliency mask is generated using spatial attention, and the corresponding mathematical expression is: in: Use the Sigmoid activation function; This indicates a convolution operation with a kernel size of 7; This refers to the feature map after the aforementioned channel attention filtering and adjustment, i.e., the first multi-scale feature map. In the serial structure of CBAM, the original multi-scale feature map... First, the image undergoes channel attention filtering. The output is multiplied by the original image to obtain the enhanced feature map. This feature map, which has been enhanced with channel information, is the first multi-scale feature map. ,Right now ; This represents the feature map after channel weighting. The average pooling operation performed along the channel dimension aims to aggregate the feature statistics of different channels at the same spatial location, thereby generating a descriptor to describe the spatial distribution background; Indicates the feature map Max pooling is performed along the channel dimension to extract the strongest salient feature response across channels at that spatial location, generating a descriptor to describe spatial saliency. Indicates splicing along the channel; The generated spatial attention map, or saliency mask, enables the model to automatically focus on key candidate regions such as solder joints before semantic guidance intervenes, effectively suppressing irrelevant background regions. This mechanism is used to automatically highlight solder joint regions.
[0063] Finally, the focused feature map is obtained. The corresponding mathematical expression is: in, This indicates element-wise multiplication.
[0064] Based on this, this embodiment obtains the foundation for multi-scale visual feature extraction and uses an unsupervised approach to remove background noise in the spatial dimension, providing a clean input for subsequent semantic guidance.
[0065] Next, the focus feature map is executed. Frequency domain decoupling is achieved by using signal processing mechanisms to decompose the focused visual features into orthogonal low-frequency structural components and high-frequency texture components in the physical dimension.
[0066] Reference Figure 5 , Figure 5 A flowchart illustrating frequency division decoupling provided in an embodiment of this application.
[0067] Specifically, such as Figure 5 As shown, the frequency division decoupling includes: C1: Use average pooling to simulate a low-pass filter to extract the original low-frequency texture features, which include the color distribution of solder joints and the overall structural information of solder joints.
[0068] In this specific application, average pooling is used to simulate a low-pass filter to extract low-frequency components such as color distribution and overall structural information. The corresponding mathematical expression is: in: use Core size, step size of 1, padding size of 1; It is the core visual feature map after spatial saliency enhancement, which serves as the original input reference for frequency domain decoupling; As the original low-frequency texture features, through the analysis of... implement The average pooling operation allows the model to filter out high-frequency details in the image, extract smooth color distribution and overall geometric structure information, thereby obtaining the original low-frequency texture features.
[0069] C2: Using the difference method, the original high-frequency texture features are extracted, which include the edges of the solder joints and the texture details of the solder joints.
[0070] In this specific application, the finite difference method is used to extract high-frequency components such as edges and texture details. The corresponding mathematical expression is: in: Indicates the original low-frequency texture features The upsampling operation restores the low-frequency feature map, which has been reduced in dimensionality through pooling, to a level similar to the original focused feature map. The same spatial resolution ensures that the two can perform one-to-one differential operations at pixel positions; original signal It is composed of the superposition of low and high frequencies, due to The high-frequency texture features were extracted using average pooling (low-pass filtering). The remaining high-frequency texture features were obtained by subtracting the original signal from the original low-frequency texture features. .
[0071] Based on this, using signal processing principles, visual features are physically decomposed into two orthogonal components: texture at high frequencies and structure at low frequencies, to solve the problem of feature confusion between different types of defects. At this point, It mainly includes structural defects such as missing parts and holes; It mainly includes texture-type defects such as solder splatter and solder spikes.
[0072] S30: Based on frequency division gate weights and combined with residual connections, the original solder joint features are updated to obtain optimized solder joint features, including optimized high-frequency texture features and optimized low-frequency texture features.
[0073] For S30, this embodiment calculates an adaptive positive-negative contrast gate based on the aforementioned frequency division gate weights, projects the semantic prototype onto the visual space, introduces a learnable adaptive inhibition factor, calculates the activation weights of semantics on visual features, and performs dynamic suppression of negative good features; the calculated gate weights are used to perform nonlinear activation and residual reconstruction on the original frequency domain components to achieve differentiated semantic guidance and complete feature reconstruction and enhancement.
[0074] Specifically, the updating of the original solder joint features includes: The original high-frequency texture features are updated using a high-frequency texture feature update formula to obtain optimized high-frequency texture features; the specific high-frequency texture feature update formula is as follows: in: To optimize high-frequency texture features; These are the original high-frequency texture features; For high-frequency texture gating weights; The original low-frequency structural features are updated using a low-frequency structural feature update formula to obtain optimized low-frequency structural features; the specific low-frequency structural feature update formula is as follows: in: To optimize low-frequency structural characteristics; This represents the original low-frequency structural characteristics; For low-frequency structure gating weights.
[0075] In updating the original solder joint features, the high-frequency components corresponding to... and low frequency components Weighting is applied, and residual connections are used to preserve original information and prevent gradient vanishing. An example is provided using a high-frequency texture feature update formula: The main part is the signal after semantic gating and filtering. If the semantic weights... If a certain area is considered not to be a defect, this value will be close to 0; The residual part represents the original physical features. Without the residual part, it would be just a simple gating operation. It is the residual that constitutes residual reconstruction. Therefore, the high-frequency texture feature update formula can be transformed and understood as follows: This means that the model adds to the original features, that is, only the parts that conform to the semantic features are amplified, while the parts that do not conform remain unchanged, thus widening the gap between defects and background.
[0076] Based on this, optimized solder joint features for image recognition were obtained.
[0077] S40: Based on optimized solder joint features, image recognition is performed to obtain solder joint defects in the PCB image to be detected, and the loss function is calculated to update the suppression factor, thereby updating the frequency division gating weight.
[0078] In the specific application of this embodiment, the enhanced high-frequency and low-frequency components are fused across domains, input into the detection head, and the category and location of the solder joint defect are output in combination with the hybrid data enhancement strategy, thereby completing cross-frequency domain fusion and prediction optimization.
[0079] Specifically, the method of image recognition based on optimized solder joint features to obtain solder joint defects in the PCB image to be detected involves: splicing optimized solder joint features, performing dimensionality reduction and fusion through a preset convolutional layer to generate a final feature map; and performing image recognition based on the final feature map to obtain solder joint defects including the position of the solder joint bounding box and the probability of the defect category.
[0080] In the specific application of this embodiment, the enhanced and optimized high-frequency texture features will be used. and optimize low-frequency structural features Perform splicing along the channel dimension, and through... The convolutional layers perform dimensionality reduction and fusion to generate the final feature map. The mathematical expression corresponding to this process is: in: This indicates splicing at the channel dimension; Indicates passage Convolutional layers are used for dimensionality reduction and fusion.
[0081] Final feature map Input the detector head, output the bounding box position and class probability.
[0082] The calculation of the loss function to update the suppression factor specifically involves: calculating and recording the total loss function during the recognition process of the final feature map, and updating the suppression factor based on the gradient of the recorded total loss function.
[0083] In the specific application of this embodiment, the total loss function during the training process Loss from bounding box regression Binary cross-entropy loss and distribution focus loss The weighted composition, and the corresponding mathematical expression is: in: , and These represent the positioning weight coefficient, classification weight coefficient, and distribution optimization weight coefficient, respectively. By adjusting the values of these three hyperparameters, the emphasis of the model on positioning accuracy and classification accuracy can be flexibly balanced in different industrial inspection scenarios.
[0084] In this embodiment, further, the bounding box regression loss The calculation formula is: in: This is the intersection-union ratio (IoU) between the predicted bounding box and the ground truth bounding box. This represents the Euclidean distance between the center point of the predicted bounding box and the center point of the ground truth bounding box; The diagonal length of the smallest bounding rectangle that can simultaneously cover both the predicted bounding box and the ground truth bounding box; This is a penalty for aspect ratio consistency.
[0085] In this embodiment, further, the binary cross-entropy loss The calculation formula is: in: Responsible for supervising whether the features selected through "positive and negative comparison" are accurately classified; This represents the prediction confidence score, which is the probability score of the current candidate region belonging to a specific defect category (such as "solder failure"), and its value ranges from [value range missing]. between; This indicates the actual label, that is, the actual classification of the sample, when there is indeed a defect in that area. When the area is a normal pad or background interference .
[0086] In this embodiment, further, the distribution focus loss The calculation formula is: in: The coordinates represent the true location of the target bounding box. They are continuous values after normalization and represent the true physical boundary of the defect edge in the image. and This represents discrete integer nodes adjacent to the actual location. Since the model output is discrete, the actual coordinates are used. Approximating the two closest integer points on the left and right, satisfying... ; and Represents the predicted probability of a node's location, i.e., the model's prediction that the boundary edge falls within the given area. Location and The probability intensity (weight) of a location. Due to reflections or silkscreen interference, the edges of PCB solder joints are often not a clear line. This allows the model to find the most robust boundary through distribution learning even when the edges are "blurred," thus improving the robustness of localization.
[0087] In a preferred embodiment of this work, to improve the model's generalization ability on long-tailed distributed data, copy-paste and mixup operations are performed simultaneously during training. For categories with a very small number of samples, the samples are randomly cropped from the source images and pasted into the good-quality background area, with pixel-level transparency blending performed to increase the diversity of training samples. This constructs a hybrid data augmentation strategy.
[0088] In a preferred embodiment of this invention, the update of the suppression factor based on the gradient of the recorded total loss function specifically involves: Set the initial value corresponding to the inhibition factor; When visual features are located in the overlapping region of positive and negative samples in the semantic space, the initial value is increased based on the gradient feedback of the loss function. When visual features are not located in the overlapping region of positive and negative samples in the semantic space, gradient feedback based on the loss function reduces the initial value.
[0089] The technical effects of the PCB solder joint defect detection method in this embodiment will now be explained in detail with reference to specific experiments.
[0090] The PCB solder joint defect detection method in this embodiment can be summarized as PCB solder joint defect detection based on fine-grained morphological semantic guidance and positive-negative contrast constraints. In practical applications, this can be understood as adding a gating module based on physical frequency domain decoupling and semantic enhancement to the existing recognition algorithm, thereby completing frequency domain decoupling and adaptive positive-negative contrast gating based on spatial focusing.
[0091] To verify the effectiveness and advancement of the PCB solder joint defect detection method based on fine-grained morphological semantic guidance and positive-negative contrast constraints proposed in this embodiment, detailed comparative experiments were conducted on a real industrial PCB solder joint dataset. The experiments focused on examining the model's anti-interference ability under complex lighting conditions (false alarm rate control) and its ability to capture minute defects under extremely long-tailed distributions (recall rate and generalization).
[0092] The experimental setup and evaluation indicators are explained below.
[0093] Notes on the dataset: An industrial dataset containing various typical solder joint defects (such as solder blasting, missing leads, missing components, and holes) is used. Among them, "solder blasting" and "missing components" are extremely long-tailed categories, with only 9 and 5 samples respectively in the validation set, and the background contains a large number of high-frequency noise points (such as dust and reflections) similar to the defects.
[0094] Note regarding the baseline model: The standard YOLOv8 single-stage object detection network is used as the baseline.
[0095] Description of the model in this embodiment: Multi-frequency morphological decoupling gating, adaptive positive-negative contrast constraint mechanism and CBAM spatial focusing are implanted on the basis of YOLOv8, and a hybrid data augmentation strategy is used for training.
[0096] Explanation of evaluation metrics: Precision (P), Recall (R), and Mean Precision (mAP@0.5) are used as the core evaluation metrics. Among them, Precision mainly reflects the model's ability to suppress false positives, while mAP mainly reflects the model's overall detection performance.
[0097] The quantitative comparison of this embodiment with the prior art (benchmark YOLOv8) in terms of key defect categories and overall performance is shown in Table 1.
[0098] Table 1 Based on Table 1, the experimental results are analyzed in detail below: Analysis of the effect of adaptive positive-negative contrast constraints on false alarm suppression: Experimental data shows that the baseline model's accuracy for the "splattered solder" category is only 0.521, meaning that nearly half of the alarms are false alarms. This is because existing technology cannot distinguish between genuine "serrated solder dross" and "irregular reflections" or "dust" in the background. In contrast, the accuracy of this embodiment is improved to 0.956 (an improvement of 83.5%). This strongly demonstrates the effectiveness of the adaptive positive-negative contrast constraint mechanism. By introducing an adaptive inhibition factor, feature responses that conform to negative good product semantics are explicitly subtracted in the feature space, successfully eliminating high-frequency background noise and achieving low false alarm identification for difficult defects.
[0099] Analysis of the precise differentiation of complex textures and structures through multi-frequency morphological decoupling: For solder brittle, representing a high-frequency texture defect, this embodiment improves the mAP to 0.995; for leadless defects, representing a low-frequency structural defect, the mAP is improved to 0.973. This bidirectional improvement verifies the core value of multi-frequency morphological decoupling gating. Existing technologies often confuse texture and structural features, leading to a mismatch between the two. This embodiment, through dual-path orthogonal guidance, allows high-frequency semantics to specifically activate texture features, and low-frequency semantics to specifically activate structural features, thus perfectly balancing the detection accuracy of defects with different physical causes within the same model.
[0100] Analysis of the generalization breakthrough of semantic guidance and hybrid enhancement in small sample sizes: Under the stringent conditions of only 9 "soldering" samples and 5 "missing component" samples in the validation set, this embodiment achieved a 100% recall rate (R=1), and its mAP significantly outperformed the baseline model. This demonstrates that by leveraging prior knowledge injection of CLIP physical semantics and combining it with a Copy-Paste hybrid data augmentation strategy, the model successfully overcomes the overfitting problem caused by the long-tailed distribution of data. Even with only a very small number of samples provided by the user, it can quickly converge and accurately pinpoint rare defects based on the physical morphology description.
[0101] In summary, the PCB solder joint defect detection method of this embodiment proposes a method based on fine-grained morphological semantic guidance and positive-negative contrast constraints. This method creatively integrates multi-frequency domain physical semantics, spatial attention mechanisms, and a single-stage target detection network. First, an offline frequency-division morphological semantic library is constructed based on the red-blue structured light imaging principle, decoupling defect features into high-frequency texture and low-frequency structural descriptions, thereby endowing the model with the ability to understand the causes of defects in the physical frequency domain. Subsequently, a multi-frequency morphological decoupling gating module is used to first focus key areas and filter out background noise using the CBAM mechanism, and then combined with an innovative adaptive positive-negative contrast constraint mechanism. By introducing an automatically updated adaptive suppression factor, the affinity between the image frequency domain components and the semantic vectors of positive defects and negative good products is dynamically calculated, intelligently enhancing defect features at specific frequencies and adaptively suppressing background interference from good products. The generated frequency-division semantic guidance weights are differentially applied to visual features, realizing orthogonal guidance for finding textures at high frequencies and structures at low frequencies, significantly improving the model's ability to distinguish difficult defects. To further enhance performance and generalization ability, a hybrid enhancement strategy targeting long-tailed distributions is introduced, combined with CIoU loss function optimization, effectively solving the feature learning challenge under conditions of very few samples. Finally, the semantically enhanced features are input into the prediction layer to generate the final detection results. Compared with existing technologies, this method shows significant advantages in greatly improving the accuracy of small and difficult defects, enhancing the recall ability of small samples, and improving the physical interpretability of the model, making it suitable for high-precision automated optical inspection systems in electronic manufacturing. In summary, the method proposed in this embodiment solves the two major pain points of high false alarms and difficulty in detecting small samples in industrial appearance inspection while maintaining high recall. In particular, it achieves a leapfrog improvement in performance in the identification of small and difficult defects, and has industrial practical value.
[0102] Reference Figure 6 , Figure 6 The diagram shows the structural block diagram of the PCB solder joint defect detection system provided in the embodiments of this application; in the diagram: 10, frequency division gating weight construction module; 20, original feature decoupling module; 30, frequency division optimization feature module; 40, defect detection and updating module.
[0103] Secondly, such as Figure 6As shown, this embodiment also discloses a PCB solder joint defect detection system, which applies the PCB solder joint defect detection method described above, including: The frequency division gate weight construction module 10 is used to construct frequency division gate weights including high-frequency texture gate weights and low-frequency structure gate weights based on the frequency division semantics of PCB solder joints, including high-frequency texture semantics, low-frequency structural semantics and good product background semantics, and the preset suppression factor for suppressing the good product background of PCB solder joints. The original feature decoupling module 20 is used to perform frequency division decoupling on the preprocessed PCB image to be detected, and obtain the original solder joint features including the original high-frequency texture features and the original low-frequency texture features. The frequency division optimization feature module 30 is used to update the original solder joint features based on the frequency division gate weight and combined with the residual connection to obtain optimized solder joint features including optimized high-frequency texture features and optimized low-frequency texture features. The defect detection and update module 40 is used to perform image recognition based on optimized solder joint features, obtain solder joint defects in the PCB image to be detected, and calculate the loss function to update the suppression factor, thereby updating the frequency division gating weight.
[0104] It should be noted that the PCB solder joint defect detection system of this embodiment corresponds to the aforementioned PCB solder joint defect detection method. Therefore, any content not specifically described in the PCB solder joint defect detection system of this embodiment, including but not limited to functional definitions, working principles, and technical effects, can be referred to the description in the aforementioned PCB solder joint defect detection method, and will not be repeated here.
[0105] In the embodiments provided in this application, it should be understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, code, or any suitable combination thereof. For hardware implementation, the processor may be implemented in one or more of the following: application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, other electronic units designed to implement the functions described herein, or combinations thereof. For software implementation, some or all of the processes of the embodiments may be performed by a computer program instructing the associated hardware. During implementation, the program may be stored in a computer-readable storage medium or transmitted as one or more instructions or code on a computer-readable storage medium. Computer-readable storage media include computer storage media and communication media, wherein communication media include any medium that facilitates the transmission of a computer program from one place to another. Storage media may be any available medium accessible to a computer. Computer-readable storage media may include, but are not limited to, RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code having the form of instructions or data structures and accessible to a computer.
[0106] Finally, it should be noted that the above description is only a preferred embodiment of this application and is not intended to limit this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method of PCB solder joint defect detection, characterized by, include: Frequency division semantics based on PCB solder joints, including high-frequency texture semantics, low-frequency structural semantics, and good product background semantics, and preset suppression factors for suppressing good product background of PCB solder joints, are used to construct frequency division gating weights including high-frequency texture gating weights and low-frequency structural gating weights. The construction of frequency division gating weights includes: mapping frequency division semantics to the visual channel based on a preset linear layer; calculating a frequency division guiding vector based on the frequency division semantics mapped to the visual channel, combined with a suppression factor; wherein the frequency division guiding vector includes a high-frequency texture guiding vector and a low-frequency structure guiding vector; and obtaining a numerical value based on the frequency division guiding vector and a preset transformation function. Frequency-gated weights within the interval; the suppression factor is updated based on the gradient of the total loss function recorded, specifically: setting the initial value corresponding to the suppression factor; when the visual feature is in the overlapping region of positive and negative samples in the semantic space, the initial value is increased based on the gradient feedback of the loss function; when the visual feature is not in the overlapping region of positive and negative samples in the semantic space, the initial value is decreased based on the gradient feedback of the loss function. The preprocessed PCB image to be inspected is decoupled by frequency division to obtain the original solder joint features, including the original high-frequency texture features and the original low-frequency texture features. Based on frequency division gate weights and combined with residual connections, the original solder joint features are updated to obtain optimized solder joint features, including optimized high-frequency texture features and optimized low-frequency texture features. Image recognition is performed based on optimized solder joint features to obtain solder joint defects in the PCB image to be detected, and a loss function is calculated to update the suppression factor, thereby updating the frequency division gating weight.
2. The PCB solder joint defect detection method of claim 1, wherein, The frequency division semantics specifically involves transforming the physical description of solder joint defects into a feature vector. This transformation process includes: Based on the red-blue structured light imaging mechanism, three mutually exclusive semantic description sets are constructed, including a high-frequency texture set describing defects such as edge abrupt changes or complex textures, a low-frequency structure set describing defects such as geometric deformations or large-area color blocks, and a negative suppression set describing good product features and background interference. Feature extraction is performed on each semantic description set, and the result of the feature extraction is averaged to obtain the corresponding high-frequency texture semantics, low-frequency structure semantics, and good quality background semantics.
3. The PCB solder joint defect detection method of claim 1, wherein, The calculation of the frequency division guiding vector includes: The high-frequency texture guiding vector is calculated using the formula for calculating the high-frequency texture guiding vector; specifically, the formula for calculating the high-frequency texture guiding vector is as follows: in: High-frequency texture guiding vector; This represents high-frequency texture semantics mapped to the visual channel; As an inhibitor, Indicates will The numerical limit is within interval; This represents the semantic meaning of the good product background mapped to the visual channel; The low-frequency structure-guided vector is calculated using the formula for calculating the low-frequency structure-guided vector; specifically, the formula for calculating the low-frequency structure-guided vector is as follows: wherein: is a low-frequency structure guide vector; represents a low-frequency structure semantics mapped to the visual channel.
4. The PCB solder joint defect detection method of claim 1, wherein, The updated original solder joint features include: The original high-frequency texture features are updated using a high-frequency texture feature update formula to obtain optimized high-frequency texture features; the specific high-frequency texture feature update formula is as follows: wherein: is an optimized high-frequency texture feature; is an original high-frequency texture feature; is a high-frequency texture gating weight; The original low-frequency structural features are updated using a low-frequency structural feature update formula to obtain optimized low-frequency structural features; the specific low-frequency structural feature update formula is as follows: wherein: is an optimized low-frequency structure feature; is an original low-frequency structure feature; is a low-frequency structure gating weight.
5. The PCB solder joint defect detection method of claim 1, wherein, The preprocessing of the PCB image to be detected includes: Extract the original multi-scale feature map of the PCB image to be inspected; After filtering key feature channels in the original multi-scale feature map using channel attention, the first multi-scale feature map is output. A saliency mask is generated by spatial attention, and a focused feature map is output by combining the original multi-scale feature map and the first multi-scale feature map. This focused feature map focuses on the PCB solder joint area in the PCB image to be detected.
6. The PCB solder joint defect detection method of claim 1, wherein, The frequency division decoupling includes: The original low-frequency texture features are extracted by simulating a low-pass filter using average pooling. These original low-frequency texture features include the color distribution of solder joints and the overall structural information of the solder joints. The original high-frequency texture features are extracted using the difference method. These original high-frequency texture features include the edges of the solder joints and the texture details of the solder joints.
7. The PCB solder joint defect detection method of claim 1, wherein, The method of image recognition based on optimized solder joint features to obtain solder joint defects in the PCB image to be detected specifically involves: splicing optimized solder joint features, performing dimensionality reduction and fusion through a preset convolutional layer to generate a final feature map; and performing image recognition based on the final feature map to obtain solder joint defects including the position of the solder joint bounding box and the probability of the defect category. The calculation of the loss function to update the suppression factor specifically involves: calculating and recording the total loss function during the recognition process of the final feature map, and updating the suppression factor based on the gradient of the recorded total loss function.
8. A PCB solder joint defect detection system, employing the PCB solder joint defect detection method as described in any one of claims 1 to 7, characterized in that, include: The frequency division gating weight construction module is used to construct frequency division gating weights, including high-frequency texture semantics, low-frequency structural semantics and good product background semantics, based on the frequency division semantics of PCB solder joints, as well as the preset suppression factor for suppressing the good product background of PCB solder joints. The original feature decoupling module is used to perform frequency division decoupling on the preprocessed PCB image to be detected, and obtain the original solder joint features including the original high-frequency texture features and the original low-frequency texture features; The frequency division optimization feature module is used to update the original solder joint features based on the frequency division gate weights and combined with residual connections, so as to obtain optimized solder joint features including optimized high-frequency texture features and optimized low-frequency texture features. The defect detection and update module is used to perform image recognition based on optimized solder joint features, obtain solder joint defects in the PCB image to be detected, and calculate the loss function to update the suppression factor, thereby updating the frequency division gating weight.