A PCB solder joint defect detection method and device based on microscopic images

By using microscopic image processing and deep learning techniques, an instance segmentation network model was constructed for PCB solder joint defect detection, which solved the problems of low detection accuracy and efficiency, and achieved efficient and low-cost solder joint defect detection.

CN120833337BActive Publication Date: 2025-12-16TUOJIE (XIAN) PHOTOELECTRIC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511340187.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-19
Publication Date
2025-12-16
Estimated Expiration
2045-09-19

AI Technical Summary

Technical Problem

Existing technologies are not accurate or efficient in detecting PCB solder joint defects, and they also interfere with the printed circuit board and have high detection costs.

Method used

A PCB solder joint defect detection method based on microscopic images is adopted. Microscopic images of solder joint defects are acquired through a microscope, preprocessed and labeled, and an instance segmentation network model is constructed. Feature fusion is performed using C2FRF module and P2-FPN structure. The model is trained by combining bounding box regression loss function and focus loss function with dynamic focusing mechanism to generate solder joint defect detection results.

Benefits of technology

It improves the accuracy and efficiency of solder joint defect detection, reduces interference with circuit boards and detection costs, reduces reliance on human experience, and ensures the integrity and reliability of circuit boards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120833337B_ABST
    Figure CN120833337B_ABST
Patent Text Reader

Abstract

The application discloses a PCB solder joint defect detection method and device based on a microscopic image, and relates to the technical field of microscopic image recognition. A microscope is used to acquire a solder joint defect microscopic image, the acquired solder joint defect microscopic image is preprocessed and labeled, and a solder joint image dataset is generated; a solder joint defect detection model is constructed based on an instance segmentation network model, the solder joint defect detection model comprises a backbone network, a neck network and a detection head; a C2FRF module is used to replace a C3k2 module in the backbone network; in the neck network, a P2-FPN structure is formed to perform feature fusion; a joint loss function comprising a bounding box regression loss function based on a dynamic focusing mechanism and a focal loss function is used to guide the training of the solder joint defect detection model, and a solder joint defect detection result is obtained. The application solves the problems of low detection accuracy, interference to printed circuit boards and high detection cost in the prior art when solder joint defect detection is performed.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of microscopic image recognition, and particularly relates to a PCB solder joint defect detection method and device based on a microscopic image. BACKGROUND

[0002] A printed circuit board (PCB) is a basic connecting component of electronic product assembly parts, is crucial in the integrated circuit industry, and is the foundation of the development of intelligent manufacturing and advanced manufacturing fields. With the development of integrated circuit technology, electronic devices and PCBs are becoming smaller in size, and the connection density and component integration are increasing, which poses great challenges to the reliability and yield control of PCB production and processing.

[0003] Traditional PCB bare board and solder joint detection technologies include manual detection, electrical detection, and infrared detection methods. Manual detection relies on human experience for judgment, electrical detection detects defects through electrical characteristic analysis, and infrared detection uses infrared technology to find abnormalities. However, manual detection is low in efficiency, is easily affected by subjective factors, and has limited detection capability for complex and small defects; electrical detection may interfere with the circuit board and cannot directly present the defect morphology; and infrared detection has poor detection effect on some non-temperature-related defects and has high equipment cost.

[0004] Therefore, how to perform solder joint defect detection to improve the accuracy and efficiency of detection and reduce the interference with and detection cost of the printed circuit board has become a technical problem to be solved. SUMMARY

[0005] In the embodiments of the present application, by providing a PCB solder joint defect detection method based on a microscopic image, the problem of low detection accuracy and efficiency, interference with the printed circuit board, and high detection cost in the prior art when performing solder joint defect detection is solved.

[0006] In a first aspect, embodiments of this application provide a method for detecting PCB solder joint defects based on microscopic images. The method includes: acquiring microscopic images of solder joint defects containing a global three-dimensional morphology using a microscope; preprocessing and labeling the acquired microscopic images to generate a solder joint image dataset; constructing a solder joint defect detection model based on an instance segmentation network model, the solder joint defect detection model including a backbone network, a neck network, and a detection head; replacing the C3k2 module with a C2FRF module in the backbone network to optimize the input feature map, and inputting the optimized feature map into the neck network; in the neck network, introducing feature maps of levels 2 to 5 from the optimized feature map into a feature pyramid, forming... A P2-FPN structure is used for feature fusion to obtain multi-level fused feature maps, which are then input into the detection head. The detection head employs parameter sharing and a depthwise separable convolution lightweight detection head to convert the multi-level fused feature maps into solder joint defect detection results. A joint loss function, including a bounding box regression loss function based on a dynamic focusing mechanism and a focus loss function, guides the training of the solder joint defect detection model. The solder joint image dataset is input into the solder joint defect detection model for training, resulting in a model weight file. Microscopic images of the solder joint defects to be detected are captured using a microscope, and the model weight file is used to test these microscopic images to obtain the solder joint defect detection results.

[0007] In one possible implementation, the preprocessing and annotation of the acquired solder joint defect microscopic images to generate a solder joint image dataset includes: preprocessing the acquired solder joint defect microscopic images using a combination of contrast-limited adaptive histogram equalization and bilateral filtering; classifying the solder joint morphology in the solder joint defect microscopic images into four categories: normal solder amount, excessive solder, insufficient solder, and solder spikes, to obtain true labels; annotating the solder joints with polygons, creating masks with different contours according to the category to which each solder joint belongs, to annotate the acquired solder joint defect microscopic images and obtain true bounding boxes; performing data augmentation on the annotated solder joint defect microscopic images and converting them to YOLO format to generate a solder joint image dataset.

[0008] In one possible implementation, the step of replacing the C3k2 module with a C2FRF module in the backbone network to optimize the input feature map, and then inputting the optimized feature map into the neck network, includes: replacing the original Bottleneck module with an FRF module to obtain a C2FRF module; the FRF module enhances the information elements in the features by introducing a PConv operation; the specific operation process includes: optimizing the input feature map through a PConv operation. Perform calculations to reduce redundant channel operations; use the first linear projection of a 1×1 convolution. Adjusting the dimensions and enhancing nonlinearity using the GELU activation function yields intermediate features. ; split the intermediate feature into a first feature and a second feature along the channel ; , the Reshape transformation is applied to the second feature , a depth separable convolution operation is applied to extract spatial features, and an attention map is generated through a Flatten operation, which is element-wise multiplied with the first feature to realize feature modulation and obtain an intermediate feature after feature modulation; the second linear projection of 1x1 convolution is applied to the intermediate feature after feature modulation to perform linear transformation on the intermediate feature after feature modulation and integrate feature information of different dimensions, and the optimized feature map is output after activation by a GELU activation function . .

[0009] In a possible implementation, the 2th to 5th level feature maps in the optimized feature map are introduced into a feature pyramid in the neck network to form a P2-FPN structure for feature fusion, and a multi-level fused feature map is obtained, including: using nearest neighbor interpolation upsampling to enlarge the size of the feature map at a low level to that of a feature map at an adjacent high level Figure One ; using dynamic step size convolution downsampling to reduce the size of the feature map at a high level to that of a feature map at an adjacent low level Figure One ; and concatenating the feature maps at adjacent low levels and inputting them into a C2FRF module to fuse cross-stage features, so as to obtain the multi-level fused feature map.

[0010] In a possible implementation, the multi-level fused feature map is converted into a welding defect detection result by using a parameter sharing manner and a depth separable convolution lightweight detection head in the detection head, including: the parameter sharing manner is designed to share the same detection head parameter for the multi-level fused feature map; and a depth separable convolution and a CBS module are used to construct a lightweight detection head to convert the multi-level fused feature map into the welding defect detection result.

[0011] In a possible implementation, the joint loss function containing a bounding box regression loss function based on a dynamic focusing mechanism and a focal loss function is used to guide the training of the welding defect detection model, including: the expression of the bounding box regression loss function based on the dynamic focusing mechanism is as follows: ; wherein, is the bounding box regression loss based on the dynamic focusing mechanism, is a non-monotonic focusing coefficient, , and is a hyperparameter used to calculate the non-monotonic focusing coefficient, is the outlying degree of the anchor box, , is a gradient gain, is an exponential moving average value of is a bounding box regression loss function based on IoU, wherein IoU is an evaluation index for measuring the degree of overlap between a predicted box and a real box, is a penalty term; ; wherein, is an exponential calculation, is the horizontal coordinate of the predicted box, is the vertical coordinate of the predicted box, is the horizontal coordinate of the real box, is the vertical coordinate of the real box, is the width of the minimum closed box formed by the predicted box and the real box, is the height of the minimum closed box formed by the predicted box and the real box, is to separate the result of from the calculation graph; the expression of the focal loss function is: ; wherein, is the focal loss function, is the class balance coefficient, is the matching degree of the predicted probability and the real label, is the weight of the difficult sample; the expression of the focal loss function is: ; wherein, is the focal loss function, is the class balance coefficient, is the matching degree of the predicted probability and the real label, is the weight of the difficult sample; the expression of the joint loss function is: ; wherein, is the joint loss function, is a hyperparameter.

[0012] ​In a second aspect, the embodiments of the present application provide a PCB solder joint defect detection device based on microscopic images. The device comprises: a processing module configured to acquire a solder joint defect microscopic image containing a global three-dimensional morphology by using a microscope, to pre-process and label the acquired solder joint defect microscopic image, and to generate a solder joint image dataset; a construction module configured to construct a solder joint defect detection model based on an instance segmentation network model, the solder joint defect detection model comprising a backbone network, a neck network, and a detection head; in the backbone network, a C2FRF module is used to replace a C3k2 module to optimize the input feature map, and the optimized feature map is input to the neck network; in the neck network, the 2-5 level feature maps in the optimized feature map are introduced into a feature pyramid to form a P2-FPN structure for feature fusion, and a multi-level fused feature map is obtained, which is input to the detection head; in the detection head, a parameter sharing method and a depth separable convolution lightweight detection head are used to convert the multi-level fused feature map into a solder joint defect detection result; a guiding module configured to guide the training of the solder joint defect detection model by using a joint loss function comprising a bounding box regression loss function based on a dynamic focus mechanism and a focal loss function; a training module configured to input the solder joint image dataset to the solder joint defect detection model for training to obtain a model weight file; a solder joint defect microscopic image to be detected is captured by using the microscope, and the model weight file is used to test the solder joint defect microscopic image to be detected to obtain a solder joint defect detection result.

[0013] In a third aspect, the embodiments of the present application provide a PCB solder joint defect detection server based on microscopic images, comprising a memory and a processor; the memory is configured to store computer executable instructions; the processor is configured to execute the computer executable instructions to implement the method of the first aspect or any possible implementation manner of the first aspect.

[0014] In a fourth aspect, the embodiments of the present application provide a computer readable storage medium, which stores executable instructions, and a computer executes the executable instructions to implement the method of the first aspect or any possible implementation manner of the first aspect.

[0015] The one or more technical solutions provided in the embodiments of the present application have at least the following technical effects:

[0016] The embodiment of the present application provides a PCB solder joint defect detection method based on a microscopic image. The method adopts a microscope to obtain a solder joint defect microscopic image containing a global three-dimensional morphology, provides rich and detailed original data for detection, can clearly present various characteristics of the solder joint, and lays a foundation for accurate detection. In the main network, a C2FRF module is used to replace a C3k2 module to optimize the input feature map, enhances the feature extraction capability, and enables the model to better capture the key characteristics of the solder joint defect. The neck network introduces a P2-FPN structure to perform feature fusion on the feature maps of 2 to 5 levels, realizes effective combination of different level features, enables the model to understand the solder joint features from multiple scales, and greatly improves the recognition accuracy of various solder joint defects. In the detection head, a parameter sharing method and a depth separable convolution lightweight detection head are used to reduce the calculation amount and the parameter quantity of the model, accelerate the inference speed of the model, enable the model to quickly give a detection result when processing a large number of to-be-detected images, and significantly improve the detection efficiency. The joint loss function containing the boundary box regression loss function based on the dynamic focusing mechanism and the focal loss function is used to guide the model training, and the combination can more accurately measure the difference between the prediction result and the real label, promotes the model to learn more discriminative features, and further improves the detection accuracy. The present application detects based on the solder joint defect microscopic image, and belongs to a non-contact detection method. Compared with the traditional electrical detection method, the present application does not need to apply an electrical signal such as an electric current or a voltage to the circuit board, avoids potential damage to the circuit board caused by electrical interference, and guarantees the integrity and reliability of the circuit board. The automatic detection method based on deep learning reduces the dependence on artificial experience judgment and reduces the labor cost. Meanwhile, the automatic detection process can improve the consistency and stability of detection and reduce false detection and missed detection caused by human factors. The microscope is used to obtain the image, and compared with some special detection equipment with high cost, the microscope has the advantages of relatively low cost and relatively simple operation, can meet the detection requirements, and effectively reduces the investment cost of the detection equipment. The present application solves the problems of low detection accuracy and efficiency, interference to the printed circuit board and high detection cost in the prior art. BRIEF DESCRIPTION OF DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the description of the embodiments of the present application or the prior art. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without any creative effort on the basis of these drawings.

[0018] Figure 1 A flowchart of a PCB solder joint defect detection method based on a microscopic image provided by the embodiment of the present application;

[0019] Figure 2 A schematic diagram for creating different contour masks according to the category to which each welding point belongs, provided by an embodiment of the present application;

[0020] Figure 3 A schematic diagram for improving the detection head of the original YOLO11n-seg model, provided by an embodiment of the present application;

[0021] Figure 4 A precision-recall curve diagram of the original YOLO11n-seg model, provided by an embodiment of the present application;

[0022] Figure 5 A precision-recall curve diagram of the welding point defect detection model, provided by an embodiment of the present application;

[0023] Figure 6 A visual schematic diagram of the welding point defect detection result of the welding point defect detection model, provided by an embodiment of the present application;

[0024] Figure 7 A schematic diagram of a PCB welding point defect detection device based on microscopic images, provided by an embodiment of the present application;

[0025] Figure 8 A schematic diagram of a PCB welding point defect detection server based on microscopic images, provided by an embodiment of the present application. DETAILED DESCRIPTION

[0026] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor shall fall within the scope of protection of the present application.

[0027] The following describes some technologies related to the embodiments of the present application to facilitate understanding, which should be considered only as exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, in order to be clear and concise, some descriptions of well-known functions and structures are omitted in the following description.

[0028] The embodiments of the present application provide a PCB welding point defect detection method based on microscopic images, as shown in Figure 1 The method includes steps S101 to S108. Wherein, Figure 1The execution sequence shown is only one of the embodiments of the present application, and does not represent the only execution sequence of the PCB solder defect detection method based on microscopic images. In the case of achieving the final result, Figure 1 The steps shown can be performed in parallel or in reverse.

[0029] S101: Obtain a solder defect microscopic image containing a global three-dimensional morphology using a microscope, and perform preprocessing and annotation processing on the obtained solder defect microscopic image to generate a solder image dataset.

[0030] Specifically, to obtain comprehensive and representative solder images, the present application collects a solder practice board for soldering, i.e., a printed circuit board (PCB), and uses a microscope to take pictures of it. Considering that different SMDs have different sizes, to improve spatial resolution and display more details, the magnification value and working distance of the microscope are dynamically adjusted, with the smallest components set to the highest magnification. Since it is difficult to accurately present the precise morphology of the solder joint in an overhead shot, the SMD solder joint is photographed at a 45-degree angle through the microscope shaft side. This approach can better capture the spatial relationship between the solder joint surface and the background to obtain a solder defect microscopic image containing a global three-dimensional morphology, and make the three-dimensional morphology of the solder joint more intuitive in a two-dimensional image, providing more comprehensive feature information for the deep learning model of the present application, i.e., the solder defect detection model, and improving the recognition ability of complex defects. Ultimately, the present application obtains 450 solder defect microscopic images under a microscopic view, which cover both defective and non-defective solder joints, and the defect types include excessive soldering, insufficient soldering, and soldering tip pulling, etc.

[0031] The obtained solder defect microscopic images are preprocessed and annotated to generate a solder image dataset, including the following.

[0032] The obtained solder defect microscopic images are preprocessed and annotated to generate a solder image dataset, including the following.

[0033] Specifically, during the microscope tilting shooting process, the surface reflection and shadow effect of the solder joints easily lead to uneven distribution of image contrast, and part of the solder joint features may be covered by overexposure of bright parts or loss of dark details. The application introduces a method combining contrast-limited adaptive histogram equalization and bilateral filtering. Although the traditional global histogram equalization can improve the overall contrast, it has the problem of over-enhancement, especially in the high-contrast area of the solder joint, which may introduce artifacts or noise, interfering with subsequent defect detection. The application of contrast-limited adaptive histogram equalization not only improves the light and dark contrast of the solder joint area in the image, but also significantly improves the visibility and detail expression of the solder joint defects; the application of bilateral filtering smoothes the noise in the image, while better preserving the edges and details of the solder joint, providing clearer and more reliable image input for subsequent defect detection and solder joint segmentation, and improving the detection accuracy and robustness of the model.

[0034] The solder joint morphology in the solder joint defect microscopic image is divided into four categories: normal solder amount, excessive solder amount, insufficient solder amount, and solder tip pulling, to obtain the true label.

[0035] The solder joint is polygonally labeled, and different contour masks are created according to the category to which each solder joint belongs, to label and process the obtained solder joint defect microscopic image, to obtain the true box.

[0036] Specifically, the labeling process is carried out according to the Soldering Quality Inspection Specification for Surface Mount Components. The soldering quality of the solder joints in the data set is classified and labeled, the solder joint morphology in the image is divided into four categories: normal solder amount, excessive solder amount, insufficient solder amount, and solder tip pulling, to obtain the true label. In terms of labeling method, the application uses an open-source image annotation tool named LabelMe to polygonally label the obtained solder joint defect microscopic image, which generates a corresponding JSON format (a lightweight data exchange format) file for each instance object. The instance object in the application is a single solder joint in each solder joint defect microscopic image.

[0037] Figure 2 The schematic diagram provided by the application for creating different contour masks according to the category to which each solder joint belongs. Figure 2 (a) in FIG. 1 is a mask constructed for a solder joint with normal solder amount. Figure 2 (b) in FIG. 1 is a mask constructed for a solder joint with excessive solder amount. Figure 2 (c) in FIG. 1 is a mask constructed for a solder joint with insufficient solder amount. Figure 2(d) in the soldering tin is the mask built by the soldering tin tip. Specifically, for the soldering tin normal soldering point, a mask with downward concave is built; for the soldering tin excessive soldering point, a mask with upward convex is built; for the soldering tin insufficient soldering point, a mask with downward concave is built, but compared with the soldering tin normal soldering point, the downward concave arc is larger and the area is smaller; for the soldering tin tip soldering point, a mask with protruding contour is generated, in this way, the labeling processing of the soldering point defect microscopic image is realized, and the real frame is obtained.

[0038] The soldering point defect microscopic image processed by labeling is subjected to data enhancement, and is converted into YOLO format to generate a soldering point image data set.

[0039] Specifically, in order to increase the number of samples, the soldering point defect microscopic image processed by labeling is subjected to data enhancement, and is converted into YOLO format (a kind of labeling file format specially designed for target detection task) by adopting inversion and other ways to enhance the data by three times, and finally a soldering point image data set is generated.

[0040] S102: constructing a soldering point defect detection model based on an instance segmentation network model, the soldering point defect detection model comprising a backbone network, a neck network and a detection head.

[0041] Specifically, the instance segmentation network model used in the application is a YOLO11n-seg model.

[0042] S103: replacing the C3k2 module with the C2FRF module in the backbone network to optimize the input feature map, and inputting the optimized feature map to the neck network.

[0043] Replacing the C3k2 module with the C2FRF module in the backbone network to optimize the input feature map, and inputting the optimized feature map to the neck network includes the following.

[0044] Specifically, the input feature map in the application is a feature map obtained by convolving the soldering point defect microscopic image.

[0045] The C2FRF module is obtained by replacing the original Bottleneck module with the FRF module, and the FRF module strengthens the information elements in the features by introducing the PConv operation, and the specific operation process includes the following.

[0046] Specifically, the FRF module (Feature Refinement Feed-forward) is a feature refinement feed-forward module. The C3K2 module is a feature extraction module combining a variable convolution kernel and a channel separation strategy. The Bottleneck module is a bottleneck module combining convolution operation and optional residual connection.

[0047] C2FRF module is the improved module name, and the new module obtained after replacing the Bottleneck module with the FRF module on the basis of the original structure. PConv operation (Partial Convolution) is a partial convolution operation.

[0048] In the backbone network of YOLO11n-seg, to improve the detection performance of the welding point defects, the FRF module improves the traditional C3k2 module to obtain the C2FRF module. Since the traditional C3k2 module has weak recognition ability for welding point defects of various shapes, the C2FRF module can effectively solve this problem, which can better preserve the detail information of the welding point defects and improve the quality of the extracted features. Through optimizing the redundant information, the model pays more attention to the key features and reduces the interference of background noise. At the same time, the C2FRF module skillfully combines the PConv operation, reduces the number of convolution kernels, simplifies the calculation process, reduces the processing amount of redundant information, and thus significantly reduces the computational complexity and memory consumption.

[0049] The PConv operation is used to calculate the input feature map to reduce the redundant channel operation.

[0050] The first linear projection using 1×1 convolution adjusts the dimension and enhances the nonlinearity through the GELU activation function to obtain the intermediate feature .

[0051] 1×1 convolution is a special convolution operation with a convolution kernel size of 1×1.

[0052] The expression of the intermediate feature is: wherein, is the GELU activation function, is the first linear projection of 1×1 convolution, is the partial convolution operation, is the input feature map.

[0053] The intermediate feature is split into the first feature and the second feature along the channel. After Reshape transformation is applied to the second feature , the spatial feature is extracted by applying the depth separable convolution operation, and the attention map is generated by the Flatten operation. The element-wise multiplication is performed between the first feature and the attention map to realize feature modulation, and the intermediate feature after feature modulation is obtained.

[0054] The intermediate feature is split into the first feature and the second feature The expression of the optimized feature map is: . Wherein, is a channel slicing operation.

[0055] The expression of the intermediate feature after feature modulation is: . Wherein, is the intermediate feature after feature modulation, is an element-wise multiplication, is a Flatten operation, is a Reshape transformation, is a depth separable convolution.

[0056] The Flatten operation is a flattening operation in deep learning, and the purpose of the flattening operation is to convert a multi-dimensional tensor into a one-dimensional tensor. The Reshape transformation is an operation of converting a tensor into a tensor of a specific shape, which adapts to the input requirements of different layers of the network.

[0057] Second linear projection through 1x1 convolution Linear transformation is performed on the intermediate feature after feature modulation, the feature information in different dimensions is integrated, and the output optimized feature map is activated through the GELU activation function .

[0058] Output optimized feature map The expression of the optimized feature map is: . Wherein, is a second linear projection of 1x1 convolution.

[0059] Specifically, the FRF module can extract representative features from the information flow, enhance feature representation, simplify redundant features, and reduce useless information features along the channel dimension. Therefore, by replacing the original Bottleneck module with the FRF module, the detail information of the weld defect can be better preserved, and the detection accuracy of the model for the weld defect can be enhanced.

[0060] S104: In the neck network, the 2-5 level feature maps in the optimized feature map are introduced into the feature pyramid to form a P2-FPN structure for feature fusion, and a multi-level fusion feature map is obtained. The multi-level fusion feature map is input to the detection head.

[0061] The P2-FPN structure in the present application is a feature pyramid network introducing P2 level.

[0062] In the neck network, the 2-5 level feature maps in the optimized feature map are introduced into the feature pyramid to form a P2-FPN structure for feature fusion, and a multi-level fusion feature map is obtained. The multi-level fusion feature map includes the following contents.

[0063] nearest-neighbor interpolation up-sampling to enlarge the size of the feature maps of the lower level to be adjacent to the feature maps of the higher level Figure One .

[0064] dynamic step-size convolution down-sampling to reduce the size of the feature maps of the higher level to be adjacent to the feature maps of the lower level Figure One .

[0065] The feature maps of the adjacent lower level are spliced in the channel and fed into the C2FRF module to fuse the cross-stage features to obtain the multi-level fusion feature maps.

[0066] For the P2, P3, P4 and P5 level feature maps extracted by the backbone network, first, P5 is spliced and fused with down-sampled P4 to obtain N5, N5 is further fused by the C2FR module to obtain N'5 and is up-sampled and spliced with P4 and down-sampled P3 to generate N4, N4 is further fused by the C2FRF module to obtain N'4 and is up-sampled and spliced with P3 and down-sampled P2 to output N3; N3 is further fused by the C2FRF module to obtain N'3 and is spliced with up-sampled N'4 to obtain M3, M3 is down-sampled by convolution and is spliced with N4, down-sampled N'3 and up-sampled N'5 to generate M4, M4 is down-sampled by convolution and is spliced with N'5 and down-sampled N'4 to generate M5. In this way, the information in the feature maps of different levels is fully integrated, the detailed information in the low-level features and the semantic information in the high-level features are comprehensively utilized, and finally the multi-level fusion feature maps M3, M4 and M5 are obtained.

[0067] P2, P3, P4 and P5 level are four levels of the backbone network. N5, N'5, N4, N'4, N3 and N'3 are all intermediate feature maps in the top-down fusion path.

[0068] The feature maps of the adjacent lower level are spliced in the channel and fed into the C2FRF module to fuse the cross-stage features to obtain the multi-level fusion feature maps.

[0069] In the above manner, the information in the feature maps of different levels is fully integrated, the detailed information in the low-level features and the semantic information in the high-level features are comprehensively utilized, and finally the multi-level fusion feature maps are obtained.

[0070] The PAFPN structure (path aggregation feature pyramid network structure) used in the original YOLO11n-seg model tends to combine feature maps of the same scale, and has insufficient processing of multi-scale information, lacking comprehensive processing and fusion of multi-scale information from different resolution layers, which weakens the learning ability of the model for small and unevenly sized weld defects. The P2-FPN structure of the present application effectively solves this problem. The low-level features introduced in the present application have relatively weak semantic information, but contain more weld edge information and detail information, retain higher resolution spatial information, and can capture the small irregularities of the weld edge, which is crucial for accurate detection of weld defects. The present application continues to use the C2FRF module in the P2-FPN structure to effectively fuse multi-scale features, while adding P2-level feature maps to form P2-FPN, forming a four-level pyramid of P2-P5, making the feature transmission from shallow to deep more continuous. Under a microscope, welds are often accompanied by high reflectivity, metal particle noise or PCB background texture interference, and high-level features are easily contaminated by semantic information, while low-level features contain more bottom-level gradient information, which can better distinguish real defects from reflective artifacts, thereby improving the detection accuracy of the model in complex backgrounds.

[0071] S105: In the detection head, a parameter sharing method and a depth separable convolution lightweight detection head are used to convert the multi-level fused feature map into a weld defect detection result.

[0072] In the detection head, a parameter sharing method and a depth separable convolution lightweight detection head are used to convert the multi-level fused feature map into a weld defect detection result, including the following contents.

[0073] The parameter sharing method is a design in which the multi-level fused feature map shares the same detection head parameters.

[0074] A depth separable convolution and a CBS module are used to construct a lightweight detection head to convert the multi-level fused feature map into a weld defect detection result.

[0075] Specifically, the parameter sharing method breaks the traditional mode of setting independent detection head parameters for different level feature maps. By sharing parameters, the number of parameters of the detection head as a whole is reduced, the complexity of the model is reduced, and at the same time it is also helpful for the model to extract more common feature representations in the learning process of different level features, improving the generalization ability of the model. A depth separable convolution (DWConv) and a CBS module (convolution-batch normalization-activation module) are used to construct a lightweight detection head to achieve the goal of converting the multi-level fused feature map into a weld defect detection result.

[0076] Figure 3The schematic diagram for improving the detection head of the original YOLO11n-seg model is provided in the embodiments of the present application. In order to further deepen the lightweight degree of the detection head, the DWConv convolution module (depthwise separable convolution) with a 3x3 convolution kernel size and the CBS module with a 1x1 convolution kernel size are adopted to replace the original convolution module. The DWConv convolution decomposes the standard convolution into depth convolution and pointwise convolution, which significantly reduces the calculation amount and the number of parameters; the CBS module combines convolution, batch normalization and activation function, which further optimizes the calculation efficiency while ensuring the feature extraction capability. Figure 3 The DW-Head in the formula is a detection head.

[0077] The detection head is responsible for converting the feature map extracted by the backbone network and fused through the neck network into the final detection result, covering classification, regression and other tasks. The traditional detection head usually requires a large number of parameters, which not only increases the calculation cost, but also may affect the application of the model in the resource-limited scene. The parameter sharing detection head method is adopted in the present application, and the DWConv convolution is used to construct the detection head, aiming to realize the lightweight of the detection head, and to meet the actual needs of high-resolution microscopic image processing and edge deployment on the premise of avoiding precision loss as much as possible.

[0078] S106: A joint loss function containing a bounding box regression loss function based on a dynamic focusing mechanism and a focal loss function is used to guide the training of the welding defect detection model.

[0079] Specifically, in the training of the welding defect detection model, in order to deal with the problems of complex noise interference existing in the welding defect microscopic image, difficulty in obtaining defect samples, unbalanced sample types (relatively fewer negative samples), etc., the present application adopts a joint loss function containing a bounding box regression loss function based on a dynamic focusing mechanism and a focal loss function to guide the training of the welding defect detection model.

[0080] The expression of the bounding box regression loss function based on the dynamic focusing mechanism is: wherein, is the bounding box regression loss based on the dynamic focusing mechanism, is a non-monotonic focusing coefficient, , and is a hyperparameter for calculating the non-monotonic focusing coefficient, is the outlying degree of the anchor box, , is the gradient gain, is the exponential moving average of , is the bounding box regression loss function constructed based on IoU, wherein IoU is an evaluation index for measuring the overlapping degree of the predicted box and the real box, is a penalty term. and The value of the can be adjusted according to different data sets, and in the present application is taken as 1.9, is taken as 3, the highest detection accuracy can be achieved.

[0081] , wherein, is an exponential calculation, is the horizontal coordinate of the prediction box, is the vertical coordinate of the prediction box, is the horizontal coordinate of the real box, is the vertical coordinate of the real box, is the width of the smallest closed box formed by the prediction box and the real box, is the height of the smallest closed box formed by the prediction box and the real box, is the result of separating from the calculation graph.

[0082] The calculation graph is a basic concept in deep learning, that is, a data structure used for automatic derivation in the loss function calculation process.

[0083] Specifically, the bounding box regression loss function based on the dynamic focusing mechanism is mainly used to solve the problem of low data quality. By introducing the outlying degree evaluation anchor box quality, the detection head is effectively focused on the anchor box of ordinary quality, and the detection performance is improved.

[0084] The expression of the focal loss function is: , wherein, is the focal loss function, is the class balance coefficient, is the matching degree of the prediction probability and the real label, is the weight of the difficult sample.

[0085] Specifically, the class balance coefficient can be set according to the characteristics of the data set. The class balance coefficient is used to adjust the contribution proportion of positive and negative samples to the total loss, The greater the set, the smaller the influence of the negative sample on the loss. Since the proportion of positive samples in the solder joint image data set constructed in the present application is small and more difficult to detect, the weight of the difficult sample is introduced on the basis of to control the attention degree of the model to the difficult sample. The value range of is 0-1, and the value range of is 0-5. By continuously experimenting to select appropriate values, the parameter setting used in the present application is .

[0086] Specifically, the focal loss function is mainly used to solve the class imbalance problem, by reducing the loss of easy-to-classify samples (positive samples), so that the model pays more attention to difficult-to-classify (negative samples) samples.

[0087] The expression of the joint loss function is: . Wherein, is the joint loss function, is a hyperparameter, the value range is between 0 and 1, used to adjust the balance between the bounding box regression loss function based on the dynamic focusing mechanism and the focal loss function to achieve the optimal synergy of the two loss functions. The hyperparameter can be set to 0.4.

[0088] Specifically, the joint loss function combines the bounding box regression loss function based on the dynamic focusing mechanism and the focal loss function, aiming to simultaneously consider the industrial noise problem and the defect class imbalance problem of micro-welding spot images, and improve the detection performance of the model in complex industrial environments.

[0089] S107: Input the welding spot image dataset into the welding spot defect detection model for training, to obtain a model weight file.

[0090] Specifically, the present application is based on the Pytorch1.13.0+cuda11.6 deep learning framework for model training. The present application uses Windows 11 operating system. The GPU selected is NVIDIA GeForce RTX 4060, which provides powerful computing power for model training. The CPU is i7-137000T, which guarantees the overall running efficiency of the system. The model development is carried out using Python 3.10 programming language.

[0091] The training parameters of the present application are set as follows. The model input size is set to 640x640, ensuring that the input images have uniform specifications for easy model processing. The number of samples per batch is set to 16, i.e. 16 images are processed each time, balancing the calculation efficiency and training effect. The stochastic gradient descent method (SGD) is used to optimize the network parameters, and the momentum is set to 0.937, which helps to accelerate the model convergence and avoid falling into local optimal solution. The initial learning rate of the weight is 0.01, which provides a suitable step length for model parameter update; the weight decay is 0.0005, which prevents model overfitting. A total of 200 rounds of training are performed, while setting an early stopping mechanism, which stops training in advance when the model performance on the validation set no longer improves, saving training time and computing resources.

[0092] The processing procedure of the backbone network is as follows. After the solder joint image dataset is input into the backbone network of the solder joint defect detection model, the image is processed in turn through the convolution module and the designed C2FRF module. In the feature extraction process, important features are strengthened, redundant information is simplified, useless features are removed, and the detail information of the solder joint defect is retained, and finally the optimized feature map is output. The optimized feature map contains different levels of feature information extracted from the solder joint defect image, providing a basis for the processing of the subsequent modules.

[0093] The processing procedure of the neck network is as follows. The neck network receives the optimized feature map from the backbone network and the feature information of different sizes captured by the C2FRF module. Further, the P2-FPN structure is used to comprehensively process and fuse the multi-scale detail features of different resolution layers, effectively combining high-level semantic information and low-level spatial information, and outputting a multi-level fusion feature map to improve the detection capability of the model for defects of different scales.

[0094] The processing procedure of the detection head is as follows. The detection head receives the multi-level fusion feature map processed by the neck network. In the detection head, a parameter sharing method is used for lightweight defect detection classification of the multi-level fusion feature map, which reduces the computational complexity of the model while ensuring detection accuracy and improves detection efficiency.

[0095] S108: A microscope is used to shoot a solder joint defect microscopic image to be detected, and a model weight file is used to test the solder joint defect microscopic image to be detected, to obtain a solder joint defect detection result.

[0096] Specifically, the model performs feature extraction, fusion and classification on the input solder joint defect microscopic image to be detected, and finally obtains a solder joint defect detection result, realizing accurate identification and classification of PCB solder joint defects.

[0097] Figure 4 The precision-recall curve of the original YOLO11n-seg model provided by the embodiments of the present application is shown in the figure. Figure 5 The precision-recall curve of the solder joint defect detection model provided by the embodiments of the present application is shown in the figure. Figure 4 and Figure 5 In the figure, the horizontal axis Recall represents recall rate, and the vertical axis Precision represents precision. good represents a normal soldering amount category, Figure 4 0.947, Figure 5 0.972. exc_solder represents a soldering amount category, Figure 4 0.980, Figure 5 0.988. poor_solder represents a soldering amount category, Figure 4 0.908, Figure 5is 0.956. Spike represents the category of solder tip, Figure 4 is 0.770, Figure 5 is 0.823. All classes represents the average precision (mAP@0.5) of all categories, that is, the average precision when the IoU threshold is 0.5, Figure 4 is 0.901, Figure 5 is 0.935. The values of the solder defect detection model of the present application in each category are improved, proving the effectiveness of the improved model.

[0098] Figure 6 is a solder defect detection result visualization diagram of the solder defect detection model provided by the embodiment of the present application. From Figure 6 It can be seen that the solder shape is complex and the size is different. Since the C2FRF and P2-FPN modules are designed in the solder defect detection model, the network's ability to capture global information and suppress noise is improved, and different layer receptive field features are effectively fused, so the solder defects with different sizes and blurred boundaries can be accurately detected, and the detection accuracy of the original model is improved.

[0099] In summary, based on the solder defect detection model, different types of solder defects of different sizes can be well detected. The improved model incorporates the P2-FPN module, which can effectively solve the problem of difficult detection of multi-scale solder microscopic images. By incorporating the P2 layer into feature fusion, effective fusion of high-level semantic features and low-level features is achieved, significantly improving the feature expression ability of the model. The parameter-shared DW-head detection head and the PConv and DWConv introduced in the C2FRF significantly reduce the computational complexity and memory consumption. At the same time, the improved joint loss function mixes two loss functions, which not only enhances the robustness of the model, but also does not affect the model parameter amount and other indicators.

[0100] The embodiment of the present application also provides a PCB solder defect detection device 700 based on a microscopic image, as shown in Figure 7 The device comprises a processing module 701, a construction module 702, a guidance module 703 and a training module 704.

[0101] The processing module 701 is used to acquire solder defect microscopic images containing global three-dimensional morphology by using a microscope, and to perform preprocessing and labeling processing on the acquired solder defect microscopic images to generate a solder image dataset.

[0102] The construction module 702 is configured to construct a welding defect detection model based on an instance segmentation network model, the welding defect detection model comprising a backbone network, a neck network and a detection head. In the backbone network, a C2FRF module is used to replace a C3k2 module, and the input feature map is optimized, and the optimized feature map is input to the neck network. In the neck network, the 2-5 level feature maps in the optimized feature map are introduced into a feature pyramid to form a P2-FPN structure for feature fusion, and a multi-level fusion feature map is obtained, and the multi-level fusion feature map is input to the detection head. In the detection head, a parameter sharing method and a depth separable convolution lightweight detection head are used to convert the multi-level fusion feature map into a welding defect detection result.

[0103] The guidance module 703 is configured to guide the welding defect detection model training by using a joint loss function comprising a boundary box regression loss function based on a dynamic focus mechanism and a focal loss function.

[0104] The training module 704 is configured to input a welding image dataset into the welding defect detection model for training to obtain a model weight file, use a microscope to capture a welding defect microscopic image to be detected, and use the model weight file to test the welding defect microscopic image to be detected to obtain a welding defect detection result.

[0105] Some of the modules in the device described in the present application can be described in the general context of computer-executable instructions, such as program modules, which are executed by computers. Generally, program modules include routines, programs, objects, components, data structures, classes, and the like, which perform particular tasks or implement particular abstract data types. The present application can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are connected through a communication network. In a distributed computing environment, program modules can be located in both local and remote computer storage media including storage devices.

[0106] The device or module described in the above application embodiment can be specifically implemented by a computer chip or entity, or by a product with certain functions. For the convenience of description, the above device is described as various modules respectively described in terms of functions. When implementing the embodiments of the present application, the functions of each module can be implemented in the same software and / or hardware or multiple software and / or hardware. Of course, the module implementing a certain function can also be implemented by multiple sub-modules or sub-units.

[0107] The methods, apparatuses or modules described in the present application can be implemented in a computer readable program code manner. The controller can be implemented in any appropriate manner, for example, the controller can take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (for example, software or firmware) executable by the (micro)processor, logic gates, switches, an application specific integrated circuit (Application Specific Integrated Circuit, in short: ASIC), a programmable logic controller and an embedded microcontroller. Examples of the controller include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that, in addition to implementing the controller in a pure computer readable program code manner, the same function can also be implemented by logically programming the method steps in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers and embedded microcontrollers. Therefore, such a controller can be considered as a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can even be considered as both a software module implementing the method and a structure within the hardware component.

[0108] As shown in Figure 8 The embodiment of the present application also provides a PCB solder joint defect detection server based on a microscopic image, which comprises a memory 801 and a processor 802; the memory 801 is used for storing computer executable instructions; and the processor 802 is used for executing the computer executable instructions to realize the PCB solder joint defect detection method based on a microscopic image provided in the above embodiment of the present application.

[0109] The embodiment of the present application also provides a computer readable storage medium, which stores executable instructions, and a computer executes the executable instructions to realize the PCB solder joint defect detection method based on a microscopic image provided in the above embodiment of the present application.

[0110] From the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary hardware. Based on such an understanding, the technical solutions of the present application can be embodied in the form of a software product or can be embodied in the implementation process of data migration. The computer software product can be stored in a storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a mobile terminal, a server, or a network device, etc.) to execute the methods described in the embodiments of the present application.

[0111] The various embodiments in the specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment mainly describes the difference from other embodiments. The whole or part of the present application can be used in a plurality of general or special computer system environments or configurations.

[0112] The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the present application; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the present application.

Claims

1. A method for detecting PCB solder joint defects based on microscopic images, characterized in that, include: Microscopic images of solder joint defects containing global three-dimensional morphology were acquired using a microscope. The acquired microscopic images of solder joint defects were preprocessed and annotated to generate a solder joint image dataset. A solder joint defect detection model is constructed based on an instance segmentation network model. The solder joint defect detection model includes a backbone network, a neck network, and a detection head. The C2FRF module is used instead of the C3k2 module in the backbone network to optimize the input feature map, and the optimized feature map is then input into the neck network. In the neck network, the feature maps of levels 2 to 5 in the optimized feature map are introduced into the feature pyramid to form a P2-FPN structure for feature fusion, and multi-level fused feature maps are obtained. The multi-level fused feature maps are then input into the detection head. The detection head employs a parameter-sharing approach and a depth-separable convolution lightweight detection head to convert multi-level fused feature maps into weld joint defect detection results. A joint loss function, including a bounding box regression loss function based on a dynamic focusing mechanism and a focus loss function, is used to guide the training of the weld joint defect detection model. The solder joint image dataset is input into the solder joint defect detection model for training, and the model weight file is obtained. Microscopic images of the solder joint defects to be detected were taken using a microscope, and the model weight file was used to test the microscopic images of the solder joint defects to be detected, so as to obtain the detection results of the solder joint defects. The process of preprocessing and labeling the acquired solder joint defect microscopic images to generate a solder joint image dataset includes: preprocessing the acquired solder joint defect microscopic images using a combination of contrast-limited adaptive histogram equalization and bilateral filtering; classifying the solder joint morphology in the solder joint defect microscopic images into four categories: normal solder amount, excessive solder, insufficient solder, and solder spikes, to obtain true labels; annotating the solder joints with polygons, creating masks with different contours based on the category of each solder joint to annotate the acquired solder joint defect microscopic images and obtain true bounding boxes; performing data augmentation on the annotated solder joint defect microscopic images and converting them to YOLO format to generate a solder joint image dataset. The method of replacing the C3k2 module with a C2FRF module in the backbone network to optimize the input feature map, and then inputting the optimized feature map into the neck network, includes: replacing the original Bottleneck module with an FRF module to obtain the C2FRF module; the FRF module enhances the information elements in the features by introducing the PConv operation; the specific operation process includes: optimizing the input feature map through the PConv operation. Perform calculations to reduce redundant channel operations; use the first linear projection of a 1×1 convolution. Adjusting the dimensions and enhancing nonlinearity using the GELU activation function yields intermediate features. ; intermediate features Disassembled into the first feature along the channel Second feature Regarding the second feature After performing the Reshape transformation, spatial features are extracted using depthwise separable convolution operations, and an attention map is generated through the Flatten operation, which is then compared with the first feature map. Element-wise multiplication is performed to achieve feature modulation, obtaining intermediate features after feature modulation; a second linear projection is then performed using a 1×1 convolution. The intermediate features after feature modulation are linearly transformed to integrate feature information from different dimensions. After activation by the GELU activation function, the optimized feature map is output. .

2. The PCB solder joint defect detection method based on microscopic images according to claim 1, characterized in that, In the neck network, feature maps of levels 2 to 5 from the optimized feature maps are introduced into a feature pyramid to form a P2-FPN structure for feature fusion, resulting in multi-level fused feature maps, including: Nearest neighbor interpolation upsampling is used to enlarge the size of the low-level feature map to match that of the adjacent high-level feature map. Dynamically adjusted stride convolutional downsampling is used to reduce the size of high-level feature maps to be consistent with the size of adjacent low-level feature maps. The adjacent low-level feature maps are concatenated and fed into the C2FRF module to fuse cross-stage features, thereby obtaining a multi-level fused feature map.

3. The PCB solder joint defect detection method based on microscopic images according to claim 2, characterized in that, The method employs parameter sharing and a depthwise separable convolution lightweight detection head to convert multi-level fused feature maps into solder joint defect detection results, including: The parameter sharing method is a design in which multi-level fused feature maps share the same detection head parameters; A lightweight inspection head is built using depthwise separable convolution and CBS modules to convert multi-level fused feature maps into weld joint defect detection results.

4. The PCB solder joint defect detection method based on microscopic images according to claim 3, characterized in that, The method of using a joint loss function, which includes a bounding box regression loss function based on a dynamic focusing mechanism and a focus loss function, to guide the training of the weld joint defect detection model includes: The expression for the bounding box regression loss function based on the dynamic focusing mechanism is: ;in, For bounding box regression loss based on dynamic focusing mechanism, The non-monotonic focusing coefficient, , and The hyperparameters used to calculate the non-monotonic focusing coefficients, The outlier of the anchor frame is denoted as . , It is gradient gain. for The exponential moving average, It is a bounding box regression loss function built on the basis of IoU, where IoU is an evaluation metric that measures the degree of overlap between the predicted box and the ground truth box. This is a penalty item; ;in, For exponent calculation, The x-coordinate of the prediction box. The vertical coordinate of the prediction box. is the x-coordinate of the true bounding box. y is the ordinate of the true bounding box. Let be the width of the smallest closed box formed by the predicted box and the ground truth box. The height of the smallest closed box formed by the predicted box and the ground truth box. To be The results are separated from the computation graph; The expression for the focus loss function is: ;in, For focus loss function, This is the category balance coefficient. To predict the degree of match between the probability and the true label, Weights for easy and difficult samples; The expression for the joint loss function is: ;in, For the joint loss function, This is a hyperparameter.

5. A PCB solder joint defect detection device based on microscopic images, characterized in that, include: The processing module is used to acquire microscopic images of solder joint defects containing global three-dimensional morphology using a microscope, preprocess and annotate the acquired microscopic images of solder joint defects, and generate a solder joint image dataset. The building module is used to construct a solder joint defect detection model based on the instance segmentation network model. The solder joint defect detection model includes a backbone network, a neck network, and a detection head. In the backbone network, the C2FRF module is used instead of the C3k2 module to optimize the input feature map, and the optimized feature map is then input into the neck network. In the neck network, the feature maps of levels 2 to 5 in the optimized feature map are introduced into the feature pyramid to form a P2-FPN structure for feature fusion, and multi-level fused feature maps are obtained. The multi-level fused feature maps are then input into the detection head. In the detection head, a parameter sharing method and a depthwise separable convolution lightweight detection head are used to convert the multi-level fused feature maps into weld joint defect detection results. The guidance module is used to guide the training of the weld joint defect detection model using a joint loss function that includes a bounding box regression loss function based on a dynamic focusing mechanism and a focus loss function. The training module is used to input the solder joint image dataset into the solder joint defect detection model for training and obtain the model weight file; microscopic images of the solder joint defects to be detected are taken using a microscope, and the model weight file is used to test the microscopic images of the solder joint defects to be detected to obtain the solder joint defect detection results; The process of preprocessing and labeling the acquired solder joint defect microscopic images to generate a solder joint image dataset includes: preprocessing the acquired solder joint defect microscopic images using a combination of contrast-limited adaptive histogram equalization and bilateral filtering; classifying the solder joint morphology in the solder joint defect microscopic images into four categories: normal solder amount, excessive solder, insufficient solder, and solder spikes, to obtain true labels; annotating the solder joints with polygons, creating masks with different contours based on the category of each solder joint to annotate the acquired solder joint defect microscopic images and obtain true bounding boxes; performing data augmentation on the annotated solder joint defect microscopic images and converting them to YOLO format to generate a solder joint image dataset. The method of replacing the C3k2 module with a C2FRF module in the backbone network to optimize the input feature map, and then inputting the optimized feature map into the neck network, includes: replacing the original Bottleneck module with an FRF module to obtain the C2FRF module; the FRF module enhances the information elements in the features by introducing the PConv operation; the specific operation process includes: optimizing the input feature map through the PConv operation. Perform calculations to reduce redundant channel operations; use the first linear projection of a 1×1 convolution. Adjusting the dimensions and enhancing nonlinearity using the GELU activation function yields intermediate features. ; intermediate features Disassembled into the first feature along the channel Second feature Regarding the second feature After performing the Reshape transformation, spatial features are extracted using depthwise separable convolution operations, and an attention map is generated through the Flatten operation, which is then compared with the first feature map. Element-wise multiplication is performed to achieve feature modulation, obtaining intermediate features after feature modulation; a second linear projection is then performed using a 1×1 convolution. The intermediate features after feature modulation are linearly transformed to integrate feature information from different dimensions. After activation by the GELU activation function, the optimized feature map is output. .

6. A PCB solder joint defect detection server based on microscopic images, characterized in that, Including memory and processor; The memory is used to store computer-executable instructions; The processor is configured to execute the computer-executable instructions to implement the method according to any one of claims 1-4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores executable instructions, which, when executed by a computer, enable the implementation of the method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • PCB defect detection method and system based on YOLOv8 network

    CN119130935A

  • PCB (Printed Circuit Board) welding spot defect detection method, equipment and medium thereof

    CN120278964A