A pcba micro-welding point defect diagnosis method based on small sample training of transfer learning

CN122888282APending Publication Date: 2026-10-09GUANG DONG RI YUE HUI SHI YE YOU XIAN GONG SI
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

然而,不同PCBA板型在焊盘尺寸、元器件封装、阻焊层颜色和焊点排列方式方面存在差异,同时,相机安装姿态、镜头畸变、照明角度、局部阴影及焊锡镜面反射还会造成焊点图像的位置漂移、尺度变化、亮度不均和局部高光,使相同类别焊点在不同生产线或不同批次图像中的特征分布发生明显变化

Benefits of technology

该基于迁移学习小样本训练的PCBA微焊点缺陷诊断方法,通过焊盘几何基准、局部照明背景场以及几何校正残差和光度校正残差对源域和目标域微焊点图像进行统一校正,并构建与图像位置对应的校正可信度,使镜头畸变、板体偏移、局部阴影和焊锡高光所产生的不可靠图像响应在后续诊断过程中受到差异化约束;进一步根据基础特征的域漂移程度和缺陷敏感程度确定迁移权重,使板型、封装和成像条件变化引起的非缺陷特征得到抑制,同时保留焊锡轮廓、焊盘覆盖和局部边缘异常等缺陷判别特征;通过融合源域类别先验、目标域少量支持样本、图像校正可信度及焊点拓扑偏差,构建包括类别原型向量和类内尺度的小样本缺陷拓扑原型,降低少量异常样本或误标样本对类别中心的干扰;同时利用器件位号、引脚排列、焊盘邻接关系和缺陷空间形成特征对单焊点类别证据进行一致性校正,并通过经确认样本实施受控迁移更新,从而在目标域缺陷样本数量有限的情况下,提高不同PCBA板型及不同成像条件下微焊点缺陷诊断的准确性、稳定性和适应性,降低因图像校正误差、局部高光及共同成像扰动造成的误报和漏检。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122888282A_ABST
    Figure CN122888282A_ABST
Patent Text Reader

Abstract

The application discloses a PCBA micro-welding point defect diagnosis method based on small sample training of transfer learning, relates to the technical field of image correction, and comprises the following steps: obtaining a corrected image and a correction confidence map according to a pad geometric reference, a local illumination response, a geometric correction residual error and a photometric correction residual error; determining a transfer weight according to a domain shift degree and a defect sensitivity of basic features of a source domain and a target domain, and obtaining a transfer feature in a unified feature space; fusing a source domain prior, a small amount of support samples of a target domain, a correction confidence and a pad topological deviation to construct a small sample defect topological prototype comprising a category prototype vector and an intra-class scale; obtaining category evidence and diagnosis uncertainty according to a matching relationship between a to-be-diagnosed pad and each category prototype, and performing consistency correction in combination with a pad adjacency relationship; and performing controlled updating by using confirmed representative samples. The method can improve the accuracy of micro-welding point defect diagnosis and the cross-plate adaptability under small sample conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image correction technology, specifically to a PCBA micro solder joint defect diagnosis method based on transfer learning with few-sample training. Background Technology

[0002] Micro-solder joints in printed circuit board assemblies (PCBAs) are used to achieve mechanical and electrical connections between chip pins, component terminals, and circuit board pads. Their soldering quality directly affects the conductivity, signal integrity, and long-term operational reliability of electronic products. As chip packaging evolves towards finer pitch, miniaturization, and higher density, the size of micro-solder joints and the spacing between adjacent joints are continuously decreasing. Defects such as bridging, insufficient solder, solder joint misalignment, broken solder outlines, solder ball residue, and abnormal appearance of cold solder joints exhibit characteristics such as small defect areas, indistinct boundaries, and high visual similarity between different categories under ordinary imaging conditions.

[0003] Currently, PCBA solder joint defect detection typically employs automated optical inspection equipment to acquire solder joint images and utilizes manually set grayscale thresholds, edge features, area measurements, or deep learning classification networks for defect identification. However, different PCBA board types vary in pad size, component packaging, solder mask color, and solder joint arrangement. Furthermore, camera mounting posture, lens distortion, illumination angle, local shadows, and solder specular reflection can cause positional drift, scale changes, uneven brightness, and localized highlights in solder joint images, resulting in significant variations in the feature distribution of the same type of solder joint across different production lines or batches.

[0004] Existing image correction methods typically only apply geometric transformations or uniform grayscale equalization to the entire image, failing to establish position-dependent correction credibility based on pad geometry, local illumination response, and the reliability of highlight areas. Consequently, correction residuals are easily misinterpreted by subsequent recognition networks as solder joint contour anomalies, leading to false defect reports. On the other hand, deep learning-based defect diagnosis methods usually rely on a large number of target board type samples with accurate category labels. However, in actual production processes, normal solder joint samples are readily available, while defect samples such as bridging, insufficient solder, and cold solder joints are fewer, with some defects having only one or a few confirmed samples. This makes it difficult to support retraining the recognition model for each PCBA board type. Existing transfer learning methods often employ overall network parameter fine-tuning or uniformly reducing the difference in feature distribution between the source and target domains. They fail to adequately distinguish between features that play a role in defect discrimination and domain shift features caused by changes in board type, illumination, and imaging equipment. This can easily weaken minor defect features while improving inter-domain consistency. Furthermore, existing small sample classification methods typically use the average features of a small number of samples as the class center, without comprehensively considering the reliability of sample image correction, the topological relationship between the solder area and the pad area, and the intraclass variation scale of different defect categories. When there are reflective interference, position correction deviations, or mislabeled samples in the small number of supporting samples, the class prototype is prone to significant shift. Moreover, the independent identification results of a single solder joint usually do not combine the device pin arrangement, the connectivity relationship between adjacent pads, and the spatial extension characteristics of bridging defects for consistency verification, making it difficult to effectively distinguish between real solder joint defects and imaging interference such as common illumination anomalies and device-level position deviations.

[0005] Therefore, there is an urgent need for a PCBA micro solder joint defect diagnosis method based on transfer learning and few-sample training, which can achieve continuous collaboration of solder joint image correction, cross-board feature transfer, few-sample category prototype construction, and board-level spatial consistency diagnosis under the condition of limited target domain defect samples. Summary of the Invention

[0006] To address the shortcomings of existing technologies, this invention provides a PCBA micro solder joint defect diagnosis method based on transfer learning small sample training, in order to solve the problems mentioned in the background technology.

[0007] To achieve the above objectives, the present invention provides the following technical solution: In a first aspect, the present invention provides a PCBA micro solder joint defect diagnosis method based on transfer learning few-sample training, comprising the following steps: S1. Based on the pad design coordinates of the PCBA, the pin arrangement relationship of the device, and the source and target domain micro solder joint images, perform geometric position correction and local imaging response correction on the micro solder joint images, and construct image correction confidence based on the geometric correction residual and photometric correction residual to obtain an image correction characterization composed of the corrected image and the correction confidence map. S2. Using the corrected image and the corrected confidence map as dual-channel inputs, extract the basic features of the source domain samples and the target domain samples. Determine the transfer weights based on the inter-domain drift degree and defect category discrimination ability of each dimension of basic features. Then, weight and normalize the basic features to obtain the transfer features of the source domain samples and the target domain samples in the same feature space. S3. Based on the obtained transfer features, according to the source domain labeled samples, the target domain small number of supporting samples, the image correction confidence of each sample, and the weld point topology deviation of each sample relative to the corresponding defect category, determine the prototype contribution weight of each sample, adaptively fuse the source domain category prior with the target domain small number of supporting samples, obtain the category prototype vector and intra-class scale corresponding to each micro-weld point state category, and form a small sample defect topology prototype. S4. Based on the small sample defect topology prototype, the migration features of the micro-weld points in the target domain to be diagnosed are matched with the category prototype vectors of each micro-weld point state category, and the matching distance is normalized according to the intra-class scale of the corresponding category. Combined with the weld point topology deviation of the micro-weld points in the target domain to be diagnosed relative to each micro-weld point state category and the image correction confidence, the category matching evidence and diagnostic uncertainty of each micro-weld point state category are obtained. S5. Based on category matching evidence and diagnostic uncertainty, according to the PCBA's component reference number, pin number, pad arrangement direction, pad adjacency relationship, and spatial formation characteristics corresponding to different defect categories, establish pad adjacency constraints, perform defect spatial consistency correction on the category matching evidence of each micro solder point in the target domain to be diagnosed, and obtain the candidate state, effective diagnostic level, uncertainty type, and spatial structure basis corresponding to each micro solder point. S6. Based on candidate states, effective diagnostic levels, uncertainty types, and spatial structure, perform graded diagnostic outputs for each micro-weld point, and select representative supporting samples from the confirmed target domain micro-weld point samples. Perform controlled updates on the migration weights and small sample defect topology prototypes. If the updated diagnostic performance does not meet the preset update conditions, restore the migration weights and small sample defect topology prototypes to their original state.

[0008] To further optimize this technical solution, in step S1, geometric position correction and local imaging response correction are performed on the micro-weld point image, including: Based on the Gerber pad coordinates or mounting coordinates corresponding to the PCBA, determine the standard pad center, pad edge, pin extension direction and center distance between adjacent pads for each micro solder joint, and construct a solder joint geometric reference template. From the micro solder joint images of the source and target domains, at least one geometric anchor point is determined from the board edge positioning hole, silkscreen positioning point, solder pad corner point, and center of regularly arranged solder pads. Geometric transformation parameters are determined based on the coordinate correspondence between the geometric anchor point and the solder joint geometric reference template, and each micro solder joint is mapped to a unified standard coordinate system.

[0009] To further optimize this technical solution, the acquisition of the corrected image and the corrected confidence map includes: The local illumination background field is fitted to a stable solder mask region far from the solder outline and copper foil edge. The grayscale of the image after removing the local illumination background field is normalized according to the grayscale mean and grayscale standard deviation of the standard board reference area to obtain the corrected image. The distance between the corrected geometric anchor point and the standard geometric anchor point is calculated and normalized using the corresponding pad width or the center distance between adjacent pads to obtain the geometric correction residual. The grayscale difference between the corrected stable solder mask region and the standard board reference region is calculated and normalized using the grayscale standard deviation of the standard board reference region to obtain the photometric correction residual. The correction confidence level of the corresponding image position is reduced according to the increase of the geometric correction residual and the photometric correction residual to obtain the image correction confidence level map.

[0010] To further optimize this technical solution, in step S2, obtaining the migration features where the source domain samples and target domain samples are in the same feature space includes: Based on the basic characteristics of each source domain sample and target domain sample, the mean difference of features between the source domain sample and the target domain sample is calculated, and normalized using the joint standard deviation of the source domain sample and the target domain sample to obtain the domain drift coefficient; the defect sensitivity coefficient is obtained based on the ratio between the feature dispersion of different defect categories and the overall dispersion of all samples. The migration weight of the corresponding basic feature is increased according to the increase of the defect sensitivity coefficient, and the migration weight of the corresponding basic feature is decreased according to the increase of the domain drift coefficient. The migration weights are used to weight the basic features of each dimension, and the weighted basic features are normalized to L2 to obtain the migration features.

[0011] To further optimize this technical solution, in step S3, the determination of the prototype contribution weight of each sample includes: The sample confidence contribution is determined based on the average value of the correction confidence map obtained in step S1 within the effective area of ​​the solder joint, and the sample topology contribution is reduced based on the increase of the solder joint topology deviation. The sample confidence contribution and the sample topology contribution are combined into the prototype contribution weight.

[0012] Further optimization of this technical solution includes the formation of the small-sample defect topology prototype, comprising: The source domain prior retention coefficient is determined based on the number of supporting samples in the target domain, and the source domain prior retention coefficient decreases as the number of supporting samples in the target domain increases. The prototype contribution weights are used to weight the migration features of the supporting samples in the target domain and the migration features of the reference samples in the source domain, respectively, and the contribution of the reference samples in the source domain is adjusted using the source domain prior retention coefficient to obtain the category prototype vector of the corresponding micro-weld point state category. Based on the weighted feature distance between the migration features of the target domain support samples and the source domain reference samples and the category prototype vector, the intra-class scale of the corresponding micro-weld point state category is determined, and the category prototype vector and the intra-class scale are combined to form a small sample defect topology prototype.

[0013] To further optimize this technical solution, step S4, obtaining category matching evidence and diagnostic uncertainty for each micro-solder joint status category, further includes: The image correction characterization of the micro-weld point in the target domain to be diagnosed is input into the feature extraction network, and the migration features of the micro-weld point in the target domain to be diagnosed are obtained according to the migration weight and normalization method. The feature distance between the migration features of the micro-weld points in the target domain to be diagnosed and the prototype vectors of each category is calculated respectively. The feature distance is normalized by the intra-class scale of the corresponding category. The initial category matching degree is determined based on the normalized feature distance and the corresponding weld point topology deviation. The initial category matching degree is corrected based on the corrected confidence level of the micro-weld points in the target domain to be diagnosed, thereby obtaining category matching evidence for each micro-weld point status category; the diagnostic uncertainty is determined based on the relative difference between the largest category matching evidence and the second largest category matching evidence, as well as the corrected confidence level.

[0014] To further optimize this technical solution, in step S5, defect space consistency correction is performed on the category matching evidence of each micro-weld point in the target domain to be diagnosed, including: For the bridging category, spatial consistency correction is performed based on the bridging category matching evidence of the solder joints at both ends of the defect-related edge, the grayscale continuity between the two solder joints, and the state of the solder area spanning the pad interval. For categories of abnormal appearance such as insufficient solder, broken solder outline, or poor solder joint, reference correction is performed based on the local imaging response of other pin solder joints of the same device. For solder joint offset categories, single solder joint offset and device-level joint correction offset are distinguished based on the offset direction and offset magnitude of each solder joint of the same device.

[0015] Further optimization of this technical solution includes obtaining the candidate state, effective diagnostic level, uncertainty type, and spatial structure basis for each micro-weld point, including: When a candidate category meets the corresponding defect space formation characteristics, its effective diagnostic level is improved. When a candidate category does not meet the corresponding defect space formation characteristics and the diagnostic uncertainty is high, the corresponding micro solder point is identified as a state to be reviewed. When multiple solder points in the same device have common geometric offset or common photometric anomaly, the corresponding micro solder point is identified as an image correction anomaly state. Based on the category matching evidence after spatial consistency correction, the candidate states of each micro solder joint are determined, and the effective diagnostic level, uncertainty type, and spatial structural basis for characterizing solder continuity, insufficient pad coverage, solder joint center offset, solder boundary breakage, or image correction abnormality corresponding to the candidate states are output.

[0016] To further optimize this technical solution, in step S6, the migration weights and the small-sample defect topology prototype are updated in a controlled manner, including: Using pre-reserved source domain verification samples, target domain historical confirmation samples, and newly added representative support samples, the normal false alarm rate, defect false alarm rate, and class confusion rate before and after the update are compared. When the updated normal false alarm rate, defect false alarm rate, or class confusion rate does not meet the preset update conditions, the migration weights, class prototype vectors, and intra-class scales are restored to those before the update.

[0017] In a second aspect, the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program instructions are executed by the processor, they implement the steps of a PCBA micro solder joint defect diagnosis method based on transfer learning few-sample training as described in the first aspect of the present invention.

[0018] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program instructions are executed by a processor, they implement the steps of a PCBA micro solder joint defect diagnosis method based on transfer learning few-sample training as described in the first aspect of the present invention.

[0019] Compared with existing technologies, this invention provides a PCBA micro-solder joint defect diagnosis method based on transfer learning few-sample training, which has the following beneficial effects: This PCBA micro-solder joint defect diagnosis method, based on transfer learning and few-sample training, uniformly corrects micro-solder joint images in the source and target domains using pad geometric references, local illumination background fields, and geometric and photometric correction residuals. It also constructs a correction reliability corresponding to the image position, thus differentiating unreliable image responses caused by lens distortion, board offset, local shadows, and solder highlights during subsequent diagnosis. Furthermore, it determines transfer weights based on the domain drift degree and defect sensitivity of fundamental features, suppressing non-defect features caused by changes in board shape, packaging, and imaging conditions, while preserving defect discrimination features such as solder contours, pad coverage, and local edge anomalies. This is achieved through fusion... By employing source domain category priors, a small number of supporting samples in the target domain, image correction reliability, and solder joint topology deviations, a small-sample defect topology prototype, including category prototype vectors and intra-class scales, is constructed to reduce the interference of a small number of anomalous or mislabeled samples on the category center. Simultaneously, device reference designation, pin arrangement, pad adjacency, and defect space formation features are used to perform consistency correction on single solder joint category evidence. Controlled migration updates are implemented through confirmed samples. Thus, with a limited number of defect samples in the target domain, the accuracy, stability, and adaptability of micro-solder joint defect diagnosis under different PCBA board types and imaging conditions are improved, and false alarms and false negatives caused by image correction errors, local highlights, and common imaging disturbances are reduced. Attached Figure Description

[0020] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 This is a flowchart illustrating a PCBA micro-solder joint defect diagnosis method based on transfer learning few-sample training proposed in this invention. Detailed Implementation

[0022] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0023] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.

[0024] Secondly, the term "an embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single embodiment or an embodiment selectively excluded from other embodiments.

[0025] Example 1: Reference Figure 1 This embodiment provides a PCBA micro solder joint defect diagnosis method based on transfer learning few-sample training, including the following steps: S1. Based on the pad design coordinates of the PCBA, the pin arrangement relationship of the device, and the source and target domain micro solder joint images, perform geometric position correction and local imaging response correction on the micro solder joint images, and construct image correction confidence based on the geometric correction residual and photometric correction residual to obtain an image correction characterization composed of the corrected image and the correction confidence map.

[0026] S1.1 Determine the standard pad center, pad edge, pin extension direction, and center distance between adjacent pads for each micro solder joint based on the Gerber pad coordinates or mounting coordinates corresponding to the PCBA, and construct the solder joint geometric reference template.

[0027] S1.2 Determine at least one geometric anchor point from the micro solder joint images of the source and target domains, including board edge positioning holes, silkscreen positioning points, solder pad corner points, and the center of regularly arranged solder pads. Determine the geometric transformation parameters based on the coordinate correspondence between the geometric anchor points and the solder joint geometric reference template, and map each micro solder joint to a unified standard coordinate system.

[0028] S1.3. Fit the local illumination background field according to the stable solder resist layer area far away from the solder outline and copper foil edge, and normalize the image grayscale after removing the local illumination background field according to the grayscale mean and grayscale standard deviation of the standard board reference area to obtain the corrected image.

[0029] S1.4 Calculate the distance between the corrected geometric anchor point and the standard geometric anchor point, and normalize it using the corresponding pad width or the center distance between adjacent pads to obtain the geometric correction residual; calculate the grayscale difference between the corrected stable solder mask region and the standard board reference region, and normalize it using the grayscale standard deviation of the standard board reference region to obtain the photometric correction residual; reduce the correction confidence of the corresponding image position according to the increase of the geometric correction residual and the photometric correction residual to obtain the image correction confidence map.

[0030] In the specific implementation process, to address the issues of image position drift, scale variation, local brightness unevenness, and highlight saturation of micro-solder joints caused by different PCBA models, camera mounting postures, lens distortion, illumination angles, pad reflection intensity, and differences in the color of the circuit board solder mask, an image correction characterization that simultaneously includes geometric correction results and correction reliability is established. First, based on the Gerber pad coordinates, mounting coordinate files, or manually verified standard board images of the PCBA to be inspected, the center of the pad, the edge of the pad, the pin extension direction, and the spacing between adjacent pads corresponding to each micro-solder joint to be inspected are determined, and these are used to construct a geometric reference template for the solder joint. For both the source and target domain images, board edge positioning holes, silkscreen positioning points, pad corner points, and the center points of regularly arranged pads are extracted as geometric anchor points. When a single positioning point cannot be stably identified due to contamination, occlusion, or reflection, the arrangement direction and spacing constraints of multiple adjacent pad centers are used to compensate for the missing anchor point, thus avoiding overall correction failure due to reliance on a single marker point.

[0031] For the k-th original image in the d-th domain, radial and tangential distortions are first eliminated based on lens calibration parameters. Then, a homography transformation matrix is ​​calculated based on the correspondence between geometric anchor points and standard pad coordinates, mapping the pad center, pad edge, and pin direction to a unified standard coordinate system. After geometric correction, instead of directly applying unified histogram equalization to the entire image, a partitioned illumination response is established between the pad region, pin region, solder mask background region, and highlight region. Specifically, a low-frequency illumination background field is fitted based on a stable solder mask region far from the copper foil edge and solder outline, and the gray-scale mean and standard deviation of normal solder joints in the standard board are used as reference responses to unify the local gray-scale variations of the source and target domain images to the same response range. To prevent excessive stretching of specular reflection regions, a lower correction confidence level is set for pixels close to saturated grayscale, instead of directly deleting these regions, thus preserving the edge information required for subsequent identification of solder surface morphology.

[0032] This step establishes the following image correction model: in, For the k-th sample in the d-th domain, in coordinates Image correction characterization at the location, composed of the corrected image and correction credibility composition; The original image grayscale value is normalized to the range of 0 to 1. coordinates The corresponding homogeneous coordinates; This is the homography transformation matrix calculated based on the geometric anchor points; This indicates the conversion of homogeneous coordinates to two-dimensional coordinates; This is the low-frequency lighting background field obtained by fitting the stable solder mask region; and These represent the mean and standard deviation of the grayscale value of the stable reference region after removing the background field; and These are the mean gray level and standard deviation of the corresponding region in the standard plate reference image, respectively. To prevent dimensionless positive numbers with a denominator of zero; This means that the output will be limited to the range of 0 to 1.

[0033] The geometric correction residual is obtained by calculating the pixel distance between the corrected geometric anchor point and the standard anchor point, and dividing it by the standard width of the corresponding pad or the center distance between adjacent pads to make it a dimensionless quantity. The photometric correction residual is obtained by calculating the absolute difference between the grayscale of the stable region after correction and the reference grayscale of the standard plate, and then dividing by... ; and These are the confidence decay scales for the geometric residual and the photometric residual, respectively, both determined by the median or a preset quantile of the correction error distribution in the source domain validation samples.

[0034] Therefore, when a certain location has a large geometric deviation, unstable local lighting, or high light saturation, its It automatically reduces the image size, but the image information at that location is still preserved, thus avoiding the confusion between unreliable areas and real defect areas by traditional correction methods.

[0035] S2. Based on the image correction representation obtained in step S1, the corrected image and the correction confidence map are used as dual-channel inputs to extract the basic features of the source domain samples and the target domain samples. The transfer weights are determined according to the degree of inter-domain drift and the ability to distinguish defect categories of each dimension of basic features. The basic features are then weighted and normalized to obtain the transfer features of the source domain samples and the target domain samples in the same dimensionless feature space.

[0036] S2.1. According to the unified standard coordinate system determined in step S1, the micro solder joint area covering the pad body, solder boundary, pin end and surrounding solder mask area is extracted from the image correction representation, and the micro solder joint area is scaled according to the standard pad width and pin extension direction.

[0037] S2.2 Input the corrected image and the correction confidence map into the pre-trained feature extraction network, and use the correction confidence map to reduce the feature response corresponding to regions with large geometric correction residuals, large photometric correction residuals, or high light saturation, to obtain the basic features of each source domain sample and target domain sample.

[0038] S2.3 For each basic feature dimension, calculate the mean difference between the source domain samples and the target domain samples, and normalize it using the joint standard deviation of the source domain samples and the target domain samples to obtain the domain drift coefficient; obtain the defect sensitivity coefficient based on the ratio between the feature dispersion of different defect categories and the overall dispersion of all samples.

[0039] S2.4. Increase the migration weight of the corresponding basic feature according to the increase of the defect sensitivity coefficient, and decrease the migration weight of the corresponding basic feature according to the increase of the domain drift coefficient. Use the migration weight to weight each dimension of basic features, and perform L2 normalization on the weighted basic features to obtain the migration feature.

[0040] In the specific implementation process, to address the issues of a large number of training samples in the source domain and a small number of defect samples in the target PCBA model, as well as the feature distribution offset between different board types, pad sizes, package types, and imaging devices, a transfer feature that balances inter-domain stability and defect sensitivity is constructed. First, historical PCBA images with relatively sufficient defect annotations are used as source domain samples, and a small number of confirmed samples from the current production line to be deployed are used as target domain samples. Each micro-solder joint image in both the source and target domains is cropped using the unified coordinate system of step S1, ensuring that the cropped area simultaneously covers the pad body, solder boundary, pin end, and a pre-defined width of surrounding solder mask area. For smaller micro-solder joints, instead of direct enlargement through ordinary interpolation, anisotropic scaling is performed according to the standard pad width and pin extension direction, maintaining the proportional relationship of the solder edge in both the horizontal and vertical directions.

[0041] Correct the image With the confidence of the correction As a dual-channel input, the correction image channel provides information on solder outline, pad coverage, highlight-dark transitions, and local texture, while the correction confidence channel suppresses unstable responses caused by positioning errors, uneven illumination, and highlight areas. The transfer feature extraction network can employ a convolutional network or visual transformation network pre-trained on general industrial surface images or historical PCBA samples, but its raw output is not used directly. Instead, domain drift and defect sensitivity are calculated separately for each feature channel. Domain drift characterizes the mean difference between the source and target domains for a given feature channel; defect sensitivity characterizes the feature channel's ability to distinguish between normal solder joints and known defective solder joints. Only feature channels with both low domain drift and high defect sensitivity receive larger transfer weights, thus avoiding the weakening of defect information such as bridging, insufficient solder, offset, abnormal solder appearance, or broken solder outlines by simply pursuing consistency between the source and target domain distributions.

[0042] This step establishes the following defect-preserving transfer feature model: in, For the m-th dimension of the k-th sample in the d-th domain, all dimensions together constitute the transfer feature vector. ; For parameters Feature extraction network corrects representation based on image The generated m-th fundamental feature; The dimension of the transfer feature; The transfer weights are the values ​​corresponding to the m-th basic feature. Let be the defect sensitivity coefficient of the m-th dimension feature; Let be the domain drift coefficient of the m-th dimension feature; This is the domain drift attenuation scale.

[0043] The method for obtaining the dimensionless domain drift coefficient is as follows: Calculate the mean of the source domain samples and the target domain samples on the m-th dimension basic feature, and divide the absolute value of the difference between the two by the joint standard deviation of the source and target domains. The target domain samples can include a small number of labeled samples, or normal production images that have been corrected in step S1 but have not yet been labeled; therefore, a large number of defect labels are not required in the target domain. Defect sensitivity coefficient The acquisition method is as follows: calculate the feature dispersion between different defect categories based on the source domain labeled samples, and divide by the overall dispersion of all samples; when a certain feature has a strong distinguishing ability for different defect categories, its Larger. Domain drift attenuation scale. According to each dimension The median or upper quartile is determined to prevent excessive weight concentration caused by a few drifting abnormal channels.

[0044] During the model usage process, first output the results of step S1. Input the feature extraction network to obtain basic features in various dimensions; then update the feature statistics based on the source and target domains. And calculate based on the source domain defect annotation results Subsequently passed Each feature channel is reweighted, and the weighted feature vectors are normalized using the second norm, resulting in... This normalization brings the transfer features of different samples to a uniform scale, allowing for direct comparison using dimensionless feature distances. Unlike conventional transfer learning methods that freeze the entire network or uniformly reduce inter-domain distances, this step constrains the transfer features through a combination of "correction confidence, domain drift degree, and defect sensitivity." This weakens non-defect responses caused by board shape and lighting changes, while preserving responses related to solder outline, pad coverage ratio, and local edge anomalies.

[0045] S3. Based on the transfer features obtained in step S2, determine the prototype contribution weight of each sample according to the source domain labeled samples, a small number of target domain supporting samples, the image correction confidence of each sample, and the weld point topology deviation of each sample relative to the corresponding defect category. Adaptively fuse the source domain category prior with the small number of target domain supporting samples to obtain the category prototype vector and intra-class scale corresponding to each micro-weld point state category, forming a small sample defect topology prototype.

[0046] S3.1 Establish source domain reference sample set and target domain support sample set according to the micro solder joint state category, and determine the solder joint topology deviation of each sample relative to the corresponding micro solder joint state category based on the overlap deviation between the solder area and the pad area, the continuity deviation of the solder edge, the offset deviation of the solder body center, and the contour deviation along the pin extension direction.

[0047] S3.2. Determine the sample confidence contribution based on the average value of the correction confidence map obtained in step S1 within the effective area of ​​the solder joint, and reduce the sample topology contribution based on the increase of the solder joint topology deviation. Combine the sample confidence contribution and the sample topology contribution into the prototype contribution weight.

[0048] S3.3 Determine the source domain prior preservation coefficient based on the number of supporting samples in the target domain, so that the source domain prior preservation coefficient decreases as the number of supporting samples in the target domain increases; use the prototype contribution weight to weight the migration features of the supporting samples in the target domain and the migration features of the reference samples in the source domain respectively, and use the source domain prior preservation coefficient to adjust the contribution of the reference samples in the source domain to obtain the category prototype vector of the corresponding micro-weld point state category.

[0049] S3.4. Based on the weighted feature distance between the migration features of the target domain support samples and the source domain reference samples and the category prototype vector, determine the intra-class scale of the corresponding micro-weld point state category, and combine the category prototype vector and the intra-class scale to form the small sample defect topology prototype.

[0050] In the specific implementation process, to address the issues of some micro-solder joint defects in the target domain having only one or a few labeled samples, uneven sample numbers for different defect categories, and the tendency for a single abnormal sample to cause category center shift, a defect topology prototype integrating source domain priors and limited sample evidence from the target domain is constructed. First, a set of micro-solder joint status categories is set based on the current PCBA manufacturing process and the visible defect range. This category set includes at least a normal category and one or more defect categories. Specific defect categories can be set according to the detection object as bridging, insufficient solder, solder joint offset, solder outline breakage, solder ball residue, or other micro-solder joint anomalies that can be characterized by images. For each category, corresponding labeled samples are selected from the source domain, and a small number of supporting samples are selected from the target domain, confirmed through manual review, online re-inspection, or destructive sampling.

[0051] To avoid constructing category centers solely based on feature mean while ignoring the spatial structure of the solder joints themselves, this step calculates the solder joint topological consistency for each sample. The solder joint topological consistency is obtained based on the overlap ratio between the solder area and the pad area in the corrected image, the continuity of the solder edge in the pin extension direction, the symmetry of the left and right boundaries, and the offset of the solder body relative to the pad center. These parameters are all normalized using pad width, pad area, or standard spacing, and are therefore not directly affected by different package sizes. When a target domain supporting sample is labeled as belonging to the corresponding category, but its correction confidence in step S1 is low, or its topological structure is significantly inconsistent with most source domain samples of that category, the contribution of that sample to the category prototype is reduced to prevent mislabeled samples or abnormal imaging samples under small sample conditions from dominating the category center.

[0052] This step establishes the following small-sample defect topology prototype model: in, For a small sample defect topological prototype of category c, the class prototype vector is used. and intra-class scale composition; The set of support samples belonging to category c in the target domain; This is the set of reference samples belonging to category c in the source domain; and These are the target domain migration features and source domain migration features output in step S2, respectively. Contribute weights to the prototype corresponding to the sample; The average value of the correction confidence map obtained in step S1 within the effective area of ​​the solder joint; The topological deviation of the solder joints between the sample and category c; The topological deviation attenuation scale; The source domain prior preservation coefficients for category c; The number of valid support samples for class c in the target domain; The number of reference samples used to control the prior decay rate of the source domain.

[0053] Topological deviation The data is obtained by calculating the normalized overlap deviation, solder edge continuity deviation, center offset deviation, and pin orientation profile deviation between the sample solder area and the standard pad area, respectively, and summing each deviation according to the weights determined by the source domain validation set; each deviation is limited to the interval between 0 and 1. Topology deviation attenuation scale. The number of reference samples can be determined based on the median of the topological deviation among similar samples in the source domain. The number of defective samples expected to be available in the target domain is set, for example, to the minimum number of valid samples required to maintain a stable category prototype. This applies when the target domain category c has only one or two supporting samples. The class prototype is relatively large, and is mainly determined by source domain priors and a small amount of target domain evidence; as the number of samples that effectively support the target domain increases, Gradually decrease, allowing the category prototype to gradually migrate towards the actual feature distribution of the current production line.

[0054] Intra-class scaling in the model This is used to represent the normal fluctuation range of category c samples in the transfer feature space, rather than uniformly setting the same radius for all defect categories. For example, bridging defects with relatively stable appearance may form a smaller intra-class scale, while solder morphology-varying categories with less solder may form a larger intra-class scale. This is achieved by simultaneously outputting... and This prevents a sample from being forcibly assigned to a category solely based on its proximity to the category center. The output of this step... In subsequent steps, these features will be used together with the migration features of the sample to be diagnosed to establish a defect matching relationship with class scale constraints.

[0055] S4. Based on the small sample defect topology prototype obtained in step S3, the migration features of the micro-weld points in the target domain to be diagnosed are matched with the category prototype vectors of each micro-weld point state category. The matching distance is normalized according to the intra-class scale of the corresponding category. Combining the weld point topology deviation of the micro-weld points in the target domain to be diagnosed relative to each micro-weld point state category and the image correction confidence, the category matching evidence and diagnostic uncertainty of each micro-weld point state category are obtained.

[0056] S4.1 Input the image correction representation of the micro-weld point in the target domain to be diagnosed into the feature extraction network in step S2, and obtain the migration features of the micro-weld point in the target domain to be diagnosed according to the migration weight and normalization method determined in step S2.

[0057] S4.2 Calculate the feature distance between the migration features of the micro-weld points in the target domain to be diagnosed and the prototype vectors of each category, and normalize the feature distance with the intra-class scale of the corresponding category. Determine the initial category matching degree based on the normalized feature distance and the corresponding weld point topology deviation.

[0058] S4.3. Correct the initial category matching degree based on the correction confidence of the micro-weld points in the target domain to be diagnosed, and obtain category matching evidence for each micro-weld point status category; determine the diagnostic uncertainty based on the relative difference between the largest category matching evidence and the second largest category matching evidence and the correction confidence.

[0059] This step performs scale-normalized matching between the migration features of the micro-solder joints in the target domain to be diagnosed and the prototypes of each category. Combined with the image correction confidence level obtained in step S1 and the local topological deviation of the solder joints, it constructs category diagnostic evidence capable of distinguishing between "known defect categories," "normal categories," and "low-confidence pending verification states." First, for the k-th micro-solder joint in the PCBA to be diagnosed, its image correction representation obtained in step S1 is input into the migration feature extraction network already formed in step S2 to obtain the target domain migration feature vector. The feature extraction process uses the same image cropping range, input channel arrangement, feature channel weights, and normalization method as when constructing the category prototype, avoiding additional feature shifts caused by inconsistencies in preprocessing rules between the training and diagnostic phases. Subsequently, Each with the prototype vector of each category The comparison is performed, but instead of directly using the uncorrected Euclidean distance as the classification criterion, the intra-class scale of the corresponding categories is utilized. Normalizing the feature distance preserves the degree of dispersion of the natural morphology of different defect categories. For example, the appearance features of weld bridge defects are usually relatively concentrated, and their smaller features are less dispersed. It can improve the rejection ability of samples with boundary deviations; defects such as insufficient solder or incomplete solder contours may have significant morphological changes, and their larger This can prevent reasonable intra-class differences from being incorrectly identified as unknown anomalies.

[0060] While performing prototype distance matching, this step calculates the topological deviation relative to category c based on the solder area, pad area, and pin orientation relationship of the micro-solder joint to be diagnosed. The topology deviation adopts the same parameter definition and normalization method as in step S3, including the deviation between the solder coverage area and the category reference coverage area, the solder boundary continuity deviation, the solder body center offset deviation, and the contour distribution deviation along the pin extension direction. For the normal category, the topology reference range is jointly determined by a small number of normal supporting samples in the target domain and normal samples in the source domain; for defect categories such as bridging, insufficient solder, offset, or broken solder contours, the topology reference range is determined by the corresponding defect supporting samples. This avoids incorrectly classifying false anomalies caused by highlights, silkscreen interference, or shadows from adjacent devices into specific defect categories based solely on deep feature similarity.

[0061] This step establishes diagnostic evidence models for the following categories: in, For the category diagnostic evidence of the k-th micro-weld joint in the target domain to be diagnosed, the matching evidence corresponding to each category is used. and diagnostic uncertainty composition; This represents the total number of micro-solder joint status categories for the currently established prototypes; The migration features of the micro-solder joint to be diagnosed are output from step S2; The topological deviation of the micro-solder joint to be diagnosed relative to category c; This refers to the topology deviation constraint coefficient; The average value of the correction confidence map formed in step S1 within the effective area of ​​the current solder joint; The lowest image credibility contribution coefficient is used to avoid directly compressing all categories of evidence to zero when the correction credibility is low. and These are the maximum and second-largest values ​​among all categories of matching evidence, respectively.

[0062] Among them, the topology deviation constraint coefficient The source domain validation samples and a small number of target domain support samples are used to determine the characteristics. Specifically, while keeping the parameters of the transfer feature extraction network unchanged, different samples are statistically analyzed. The corresponding class confusion rate and normal sample false alarm rate are selected, and the value that minimizes the weighted result of the two is chosen. Minimum image confidence contribution coefficient. Based on the validation results of low-light, high-reflectivity, and slightly misaligned samples, the value should be greater than zero and less than one, so that low-confidence images still retain limited diagnostic evidence, but cannot reach the evidence level of high-confidence images. Category matching evidence The larger the value, the more the current micro-solder joint conforms to the migration characteristic distribution and topology of category c; when the maximum evidence is close to the second largest evidence, or the correction confidence is low, the uncertainty increases. Increase. This step does not immediately generate a final board-level defect conclusion based on evidence from a single solder joint, but rather increases the comprehensive category diagnostic evidence. The process is then passed to step S5, enabling the relationships between adjacent solder joints, the arrangement of device pins, and the spatial extension characteristics of defects to participate in the final diagnosis.

[0063] S5. Based on the category matching evidence and diagnostic uncertainty obtained in step S4, establish pad adjacency constraints according to the device reference number, pin number, pad arrangement direction, pad adjacency relationship and spatial formation characteristics corresponding to different defect categories of PCBA. Perform defect spatial consistency correction on the category matching evidence of each micro solder point in the target domain to be diagnosed, and obtain the candidate state, effective diagnostic level, uncertainty type and spatial structure basis corresponding to each micro solder point.

[0064] S5.1. Based on the component reference number, pin number, component to which the pad belongs, pad arrangement direction and pad spacing of the PCBA, establish a pad adjacency graph, and establish defect association edges for adjacent pads that have the possibility of solder connection.

[0065] S5.2 For the bridging category, spatial consistency correction is performed based on the bridging category matching evidence of the solder joints at both ends of the defect-related edge, the grayscale continuity between the two solder joints, and the state of the solder area crossing the pad interval. For the categories of insufficient solder, broken solder outline, or abnormal appearance of cold solder joint, reference correction is performed based on the local imaging response of other pin solder joints of the same device. For the solder joint offset category, single solder joint offset and device-level common correction offset are distinguished based on the offset direction and offset amplitude of each solder joint of the same device.

[0066] S5.3 When a candidate category meets the corresponding defect space formation characteristics, its effective diagnostic level is improved. When a candidate category does not meet the corresponding defect space formation characteristics and the diagnostic uncertainty is high, the corresponding micro solder point is determined to be in a state to be reviewed. When multiple solder points in the same device have common geometric offset or common photometric anomaly, the corresponding micro solder point is determined to be in an image correction anomaly state.

[0067] S5.4. Based on the category matching evidence after spatial consistency correction, determine the candidate state of each micro solder joint, and output the effective diagnostic level, uncertainty type, and spatial structural basis for characterizing solder continuity, insufficient pad coverage, solder joint center offset, solder boundary breakage, or image correction abnormality corresponding to the candidate state.

[0068] In the specific implementation process, this step addresses the issue that independent diagnosis of single solder joints is easily affected by local highlights, pad contamination, adjacent silkscreen, component body shadows, and local correction residuals. It combines PCBA solder joint design relationships, component pin arrangement relationships, and the spatial formation mechanisms of different defects to perform board-level spatial consistency correction on the diagnostic evidence for each micro-solder joint category. First, based on the solder joint geometric reference template used in step S1, solder joint adjacency relationships are established for the current PCBA. These adjacency relationships are not simply determined by image pixel distance, but rather by circuit board design coordinates, component reference numbers, pin numbers, the component to which the solder joint belongs, and the solder joint arrangement direction. Solder joints belonging to the same component and adjacent along the same pin arrangement direction form intra-component adjacency edges; solder joints between different components that are close but have no possibility of solder connection do not establish direct defect propagation edges; for solder joints in fine-pitch packages with bridging risks between adjacent pins, bridging association edges are established. This forms a solder joint adjacency map corresponding to the actual soldering structure, avoiding the incorrect connection of physically unrelated areas by ordinary image neighborhoods.

[0069] Based on the pad adjacency map, spatial consistency rules are set for different categories. For bridging defects, their formation characteristics are usually manifested as a continuous solder area or edge connection between two adjacent pads. Therefore, when a solder joint has high bridging evidence, it is necessary to check the bridging evidence of the solder joint at the other end of its corresponding bridging edge, the grayscale continuity between the two solder joints, and whether the solder area crosses the predetermined pad interval. Only when the above conditions meet at least the preset combination requirements are the final confidence of the bridging category improved. If only a single solder joint produces bridging characteristics, and adjacent solder joints and the middle area do not support solder connection, then its original evidence is retained and the diagnostic uncertainty is increased to prevent reflective stripes from being misidentified as bridging. For single solder joint defects such as insufficient solder, abnormal appearance of cold solder joints, or broken solder contours, it is not required that adjacent solder joints have the same state, but normal solder joints of other pins of the same device can be used as local imaging references. When multiple solder joints of the same device show a decrease in brightness in the same direction and their correction confidence decreases synchronously, it is preferentially judged as a local lighting or device shadow problem, rather than directly judging them all as insufficient solder defects.

[0070] For solder joint misalignment defects, this step determines whether the misalignment direction is structurally reasonable based on the centerline of the pins of the same device and the arrangement direction of the pads. If the solder body of a single solder joint is significantly offset relative to the center of the pad, while adjacent solder joints remain stable, it indicates that the misalignment has local defect characteristics. If all solder joints of the same device are displaced in approximately the same direction and magnitude, the device-level geometric correction residuals of step S1 are checked first, and the group of solder joints is marked as a correction verification state, rather than being diagnosed as solder joint misalignment. For defects such as solder ball residue or isolated solder balls, it is checked whether the abnormal area is located outside the effective boundary of the pad and whether there is a continuous connection between it and the adjacent solder joint body to prevent normal solder corners or reflective points of the solder mask at the edge of the pad from being misjudged as isolated defects.

[0071] In practice, the candidate category for each solder joint is first determined based on the maximum category matching evidence in step S4, and then the corresponding spatial consistency rule is invoked according to the candidate category. For solder joints that meet the category spatial structure, the effective diagnostic level of the candidate category is increased; for solder joints that do not meet the spatial structure but have low uncertainty, the candidate category is retained and marked as a single-point anomaly; for solder joints that do not meet the spatial structure and have high uncertainty in step S4, they are transferred to the pending review state. Spatial consistency correction must not directly cover the results of a single solder joint by using neighboring majority voting, because insufficient solder, offset, and local contour breakage may actually only occur in a single pin. Its role is to perform structural verification of defects with clear spatial extension rules and to suppress false alarms for solder joint groups with common imaging perturbation characteristics, rather than forcing adjacent solder joints to be of the same category.

[0072] After completing spatial consistency correction, the system outputs the corrected candidate state, effective diagnostic level, uncertainty type, and structural basis for triggering the conclusion for each micro-solder joint. The structural basis may include solder continuity between adjacent pads, insufficient coverage of a single solder joint, device-level common displacement, local boundary breakage, or insufficient correction confidence. Therefore, the diagnostic results not only include defect categories but also retain diagnostic sources related to image correction and spatial structure, enabling subsequent re-inspections to be performed targeting specific uncertainties. The board-level consistency diagnostic results output in this step serve as input for sample verification, controlled model transfer, and diagnostic rule updates in step S6.

[0073] S6. Based on the candidate states, effective diagnostic levels, uncertainty types, and spatial structure information obtained in step S5, perform graded diagnostic outputs for each micro-weld point, and select representative support samples from the confirmed target domain micro-weld point samples. Perform controlled updates on the migration weights in step S2 and the small sample defect topology prototypes in step S3. If the updated diagnostic performance does not meet the preset update conditions, restore the migration weights and small sample defect topology prototypes to their original values.

[0074] S6.1 Based on the candidate status, effective diagnostic level, uncertainty type, and spatial structure basis, each micro-weld point is classified into one of the following: definitely normal, definitely defective, low-confidence candidate defective, image correction abnormal, and unknown appearance abnormal.

[0075] S6.2 From the confirmed normal samples and confirmed defect samples after re-inspection, representative support samples with different pad sizes, different imaging positions or different defect degrees are selected based on the migration feature distance between samples, image correction reliability and spatial structure, and the representative support samples are added to the target domain support sample set corresponding to the micro solder joint state category.

[0076] S6.3. Based on the updated target domain support sample set, redetermine the class prototype vector, intra-class scale, and source domain prior preservation coefficient in step S3, and redetermine the domain drift coefficient and migration weight in step S2 based on the updated feature distribution between the target domain samples and the source domain samples.

[0077] S6.4. Using the pre-reserved source domain verification samples, target domain historical confirmation samples, and newly added representative support samples, compare the normal false alarm rate, defect false detection rate, and class confusion rate before and after the update; when the updated normal false alarm rate, defect false detection rate, or class confusion rate does not meet the preset update conditions, restore the migration weights, class prototype vectors, and intra-class scales to the state before the update.

[0078] In the specific implementation process, this step implements a tiered output of micro-solder joint diagnostic conclusions and uses confirmed high-value target domain samples to perform controlled updates on the migration feature weights of step S2 and the small-sample defect topology prototypes of step S3 to adapt to changes in production batches, solder paste status, soldering temperature profiles, camera response, and PCBA board type, while avoiding back-contamination of the model by unconfirmed automatic diagnostic results. First, based on the candidate states, effective diagnostic levels, uncertainty types, and spatial structure criteria output in step S5, micro-solder joints are classified into determined normal, determined defect, low-confidence candidate defect, image correction anomaly, and unknown appearance anomaly. Determined defect requires that the corresponding category diagnostic evidence in step S4 meets the preset requirements, the corresponding spatial or local structure rules in step S5 are valid, and the image correction confidence is not lower than the undiagnostic threshold. Determined normal requires that the evidence for the normal category is significantly higher than that for each defect category, and there are no abnormal areas outside the pads, cross-pad connections, or obvious contour interruptions. Low-confidence candidate defects refer to solder joints that have a certain category tendency but the difference between the largest and second-largest evidence is insufficient, or the spatial consistency rules are not fully satisfied. Image correction anomalies refer to situations where multiple solder joints on the same device exhibit common geometrical offsets, failure to fit localized lighting backgrounds, or excessively large highlight saturation ranges, resulting in insufficient evidence for defect identification. Unknown appearance anomalies refer to situations where the sample is significantly distant from all known class prototypes, but the image correction reliability and spatial structure information remain valid.

[0079] For samples identified as normal and defective, this step does not immediately add all results to the target domain support sample set; instead, it performs a representativeness screening. Normal samples are primarily used to update the normal class prototype and domain drift statistics for the current production batch. Defective samples can only be considered valid support samples for the target domain after manual review, offline high-magnification microscopic re-inspection, automated optical re-inspection cross-confirmation, or confirmation by process rework results. For a large number of highly similar samples within the same category, only representative samples that cover different pad sizes, lighting positions, and defect severity are retained to prevent duplicate samples from causing the category prototype to be overly biased towards a particular production batch. The representativeness screening is based on the migration feature distance output in step S2, the correction confidence level output in step S1, and the structural basis output in step S5. Samples with overly similar features and identical structural performance are not added repeatedly.

[0080] Once new target domain confirmation samples are obtained, the target domain support sample set in step S3 is first updated. and recalculate the category prototype vector. Intra-class scale and source domain prior preservation coefficient As the number of confirmed target domain samples increases, the prior contribution of the source domain gradually decreases according to the established rules in step S3, allowing the category prototype to adapt to the current PCBA product and imaging system, but without completely deviating from source domain knowledge in the small sample stage. Subsequently, the domain drift coefficient in step S2 is recalculated based on the feature distribution of the newly added target domain samples and the existing source domain samples. Only for migration weights The limited parameters of the feature extraction network near the output are adjusted. The general feature layers at the front of the network, responsible for edges, textures, and basic geometry, are kept frozen to avoid degradation of the basic image representation ability due to small sample updates. For abnormal samples in image correction, they do not participate in the defect prototype update, but instead update the applicable range of the correction parameters in step S1 based on their geometric residuals and photometric residuals, or trigger camera pose, lens contamination, and illumination module checks.

[0081] To prevent the accumulation of erroneous labels, this step sets up a prototype update rollback mechanism. After each update, the normal false alarm rate, known defect missed detection rate, and inter-category confusion are verified using fixed source domain verification samples, target domain historical confirmation samples, and currently added samples. Only when the diagnostic performance of the target domain improves after the update, and the basic recognition capability of the source domain does not exceed the allowable degradation range, are the new migration weights and category prototypes retained; otherwise, the parameters are restored to the state before the update, and the samples that caused the degradation are transferred to the review set. For unknown appearance abnormality samples, no new defect category is established until a sufficient number are formed and confirmed by process personnel; only when multiple unknown samples form a stable cluster in the migration feature space and have consistent solder joint topology and common process causes are they independently confirmed as candidate new categories. After confirmation, the corresponding small sample defect topology prototype is established according to the method in step S3.

[0082] Finally, this step outputs the defect category, diagnostic level, corresponding pad location, image correction status, diagnostic uncertainty, and structural basis for each PCBA micro-solder joint, and also outputs the board-level defect distribution results. For identified defects, re-inspection or rework can be triggered based on the component reference number and pad number; for image correction anomalies, an imaging verification instruction is output; for unknown appearance anomalies, a sample retention and process confirmation identifier is output. Through the above-mentioned hierarchical output and controlled migration update, the method can complete the initial diagnosis using source domain knowledge under the condition of a limited number of defect samples in the target domain, and gradually improve its adaptability to the current PCBA model, micro-solder joint size, and imaging conditions as the number of confirmed samples increases.

[0083] Example 2: This embodiment also provides a computer device applicable to a PCBA micro solder joint defect diagnosis method based on transfer learning few-sample training, including a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to realize the PCBA micro solder joint defect diagnosis method based on transfer learning few-sample training as proposed in the above embodiment.

[0084] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements a PCBA micro solder joint defect diagnosis method based on transfer learning few-sample training as proposed in the above embodiment.

[0085] The computer device can be a terminal, comprising a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.

[0086] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0087] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0088] More specific examples (a non-exhaustive list) of computer-readable media include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0089] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0090] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A PCBA micro-solder joint defect diagnosis method based on transfer learning few-sample training, characterized in that, Includes the following steps: S1. Based on the pad design coordinates of the PCBA, the pin arrangement relationship of the device, and the source and target domain micro solder joint images, perform geometric position correction and local imaging response correction on the micro solder joint images, and construct image correction confidence based on the geometric correction residual and photometric correction residual to obtain an image correction characterization composed of the corrected image and the correction confidence map. S2. Using the corrected image and the corrected confidence map as dual-channel inputs, extract the basic features of the source domain samples and the target domain samples. Determine the transfer weights based on the inter-domain drift degree and defect category discrimination ability of each dimension of basic features. Then, weight and normalize the basic features to obtain the transfer features of the source domain samples and the target domain samples in the same feature space. S3. Based on the obtained transfer features, according to the source domain labeled samples, the target domain small number of supporting samples, the image correction confidence of each sample, and the weld point topology deviation of each sample relative to the corresponding defect category, determine the prototype contribution weight of each sample, adaptively fuse the source domain category prior with the target domain small number of supporting samples, obtain the category prototype vector and intra-class scale corresponding to each micro-weld point state category, and form a small sample defect topology prototype. S4. Based on the small sample defect topology prototype, the migration features of the micro-weld points in the target domain to be diagnosed are matched with the category prototype vectors of each micro-weld point state category, and the matching distance is normalized according to the intra-class scale of the corresponding category. Combined with the weld point topology deviation of the micro-weld points in the target domain to be diagnosed relative to each micro-weld point state category and the image correction confidence, the category matching evidence and diagnostic uncertainty of each micro-weld point state category are obtained. S5. Based on category matching evidence and diagnostic uncertainty, according to the PCBA's component reference number, pin number, pad arrangement direction, pad adjacency relationship, and spatial formation characteristics corresponding to different defect categories, establish pad adjacency constraints, perform defect spatial consistency correction on the category matching evidence of each micro solder point in the target domain to be diagnosed, and obtain the candidate state, effective diagnostic level, uncertainty type, and spatial structure basis corresponding to each micro solder point. S6. Based on candidate states, effective diagnostic levels, uncertainty types, and spatial structure, perform graded diagnostic outputs for each micro-weld point, and select representative supporting samples from the confirmed target domain micro-weld point samples. Perform controlled updates on the migration weights and small sample defect topology prototypes. If the updated diagnostic performance does not meet the preset update conditions, restore the migration weights and small sample defect topology prototypes to their original state.

2. The PCBA micro-solder joint defect diagnosis method based on transfer learning few-sample training according to claim 1, characterized in that, In step S1, geometric position correction and local imaging response correction are performed on the micro-weld point image, including: Based on the Gerber pad coordinates or mounting coordinates corresponding to the PCBA, determine the standard pad center, pad edge, pin extension direction and center distance between adjacent pads for each micro solder joint, and construct a solder joint geometric reference template. From the micro solder joint images of the source and target domains, at least one geometric anchor point is determined from the board edge positioning hole, silkscreen positioning point, solder pad corner point, and center of regularly arranged solder pads. Geometric transformation parameters are determined based on the coordinate correspondence between the geometric anchor point and the solder joint geometric reference template, and each micro solder joint is mapped to a unified standard coordinate system.

3. The PCBA micro-solder joint defect diagnosis method based on transfer learning few-sample training according to claim 2, characterized in that, The acquisition of the corrected image and the corrected confidence map includes: The local illumination background field is fitted to a stable solder mask region far from the solder outline and copper foil edge. The grayscale of the image after removing the local illumination background field is normalized according to the grayscale mean and grayscale standard deviation of the standard board reference area to obtain the corrected image. The distance between the corrected geometric anchor point and the standard geometric anchor point is calculated and normalized using the corresponding pad width or the center distance between adjacent pads to obtain the geometric correction residual. The grayscale difference between the corrected stable solder mask region and the standard board reference region is calculated and normalized using the grayscale standard deviation of the standard board reference region to obtain the photometric correction residual. The correction confidence level of the corresponding image position is reduced according to the increase of the geometric correction residual and the photometric correction residual to obtain the image correction confidence level map.

4. The PCBA micro-solder joint defect diagnosis method based on transfer learning few-sample training according to claim 1, characterized in that, In step S2, obtaining the migration features where the source domain samples and the target domain samples are in the same feature space includes: Based on the basic characteristics of each source domain sample and target domain sample, the mean difference of features between the source domain sample and the target domain sample is calculated, and normalized using the joint standard deviation of the source domain sample and the target domain sample to obtain the domain drift coefficient; the defect sensitivity coefficient is obtained based on the ratio between the feature dispersion of different defect categories and the overall dispersion of all samples. The migration weight of the corresponding basic feature is increased according to the increase of the defect sensitivity coefficient, and the migration weight of the corresponding basic feature is decreased according to the increase of the domain drift coefficient. The migration weights are used to weight the basic features of each dimension, and the weighted basic features are normalized to L2 to obtain the migration features.

5. The PCBA micro-solder joint defect diagnosis method based on transfer learning few-sample training according to claim 1, characterized in that, In step S3, determining the prototype contribution weight of each sample includes: The sample confidence contribution is determined based on the average value of the correction confidence map obtained in step S1 within the effective area of ​​the solder joint, and the sample topology contribution is reduced based on the increase of the solder joint topology deviation. The sample confidence contribution and the sample topology contribution are combined into the prototype contribution weight.

6. The PCBA micro-solder joint defect diagnosis method based on transfer learning few-sample training according to claim 5, characterized in that, The formation of the small-sample defect topology prototype includes: The source domain prior retention coefficient is determined based on the number of supporting samples in the target domain, and the source domain prior retention coefficient decreases as the number of supporting samples in the target domain increases. The prototype contribution weights are used to weight the migration features of the supporting samples in the target domain and the migration features of the reference samples in the source domain, respectively, and the contribution of the reference samples in the source domain is adjusted using the source domain prior retention coefficient to obtain the category prototype vector of the corresponding micro-weld point state category. Based on the weighted feature distance between the migration features of the target domain support samples and the source domain reference samples and the category prototype vector, the intra-class scale of the corresponding micro-weld point state category is determined, and the category prototype vector and the intra-class scale are combined to form a small sample defect topology prototype.

7. The PCBA micro-solder joint defect diagnosis method based on transfer learning few-sample training according to claim 1, characterized in that, In step S4, obtaining category matching evidence and diagnostic uncertainty for each micro-solder joint status category further includes: The image correction characterization of the micro-weld point in the target domain to be diagnosed is input into the feature extraction network, and the migration features of the micro-weld point in the target domain to be diagnosed are obtained according to the migration weight and normalization method. The feature distance between the migration features of the micro-weld points in the target domain to be diagnosed and the prototype vectors of each category is calculated respectively. The feature distance is normalized by the intra-class scale of the corresponding category. The initial category matching degree is determined based on the normalized feature distance and the corresponding weld point topology deviation. The initial category matching degree is corrected based on the corrected confidence level of the micro-weld points in the target domain to be diagnosed, thereby obtaining category matching evidence for each micro-weld point status category; the diagnostic uncertainty is determined based on the relative difference between the largest category matching evidence and the second largest category matching evidence, as well as the corrected confidence level.

8. The PCBA micro-solder joint defect diagnosis method based on transfer learning few-sample training according to claim 1, characterized in that, In step S5, defect space consistency correction is performed on the category matching evidence of each micro-weld point in the target domain to be diagnosed, including: For the bridging category, spatial consistency correction is performed based on the bridging category matching evidence of the solder joints at both ends of the defect-related edge, the grayscale continuity between the two solder joints, and the state of the solder area spanning the pad interval. For categories of abnormal appearance such as insufficient solder, broken solder outline, or poor solder joint, reference correction is performed based on the local imaging response of other pin solder joints of the same device. For solder joint offset categories, single solder joint offset and device-level joint correction offset are distinguished based on the offset direction and offset magnitude of each solder joint of the same device.

9. The PCBA micro-solder joint defect diagnosis method based on transfer learning few-sample training according to claim 8, characterized in that, The acquisition of the candidate state, effective diagnostic level, uncertainty type, and spatial structure basis for each micro-weld point includes: When a candidate category meets the corresponding defect space formation characteristics, its effective diagnostic level is improved. When a candidate category does not meet the corresponding defect space formation characteristics and the diagnostic uncertainty is high, the corresponding micro solder point is identified as a state to be reviewed. When multiple solder points in the same device have common geometric offset or common photometric anomaly, the corresponding micro solder point is identified as an image correction anomaly state. Based on the category matching evidence after spatial consistency correction, the candidate states of each micro solder joint are determined, and the effective diagnostic level, uncertainty type, and spatial structural basis for characterizing solder continuity, insufficient pad coverage, solder joint center offset, solder boundary breakage, or image correction abnormality corresponding to the candidate states are output.

10. The PCBA micro-solder joint defect diagnosis method based on transfer learning few-sample training according to claim 1, characterized in that, In step S6, the migration weights and the small-sample defect topology prototype are updated in a controlled manner, including: Using pre-reserved source domain verification samples, target domain historical confirmation samples, and newly added representative support samples, the normal false alarm rate, defect false alarm rate, and class confusion rate before and after the update are compared. When the updated normal false alarm rate, defect false alarm rate, or class confusion rate does not meet the preset update conditions, the migration weights, class prototype vectors, and intra-class scales are restored to those before the update.