Method, device and electronic equipment for detecting component pin exposed defects

By combining 2D and 3D detection algorithms and deep learning inference models, the problem of insufficient accuracy and speed of traditional 2D detection algorithms in detecting exposed defects on NTC pins is solved, achieving more efficient detection accuracy and efficiency.

CN118071759BActive Publication Date: 2024-09-03SUZHOU JIERUISI INTELLIGENT TECH CO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410502685.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-25
Publication Date
2024-09-03
Estimated Expiration
2044-04-25

AI Technical Summary

Technical Problem

Traditional 2D inspection algorithms have problems with insufficient accuracy and speed when detecting exposed component pin defects. Especially due to the diverse morphology, low contrast and background complexity of the exposed NTC pin area, it is difficult to accurately detect partially exposed pins. Defects lead to missed detections and overkill.

Method used

Combining 2D detection algorithms, 3D detection algorithms and deep learning inference models, the semantic segmentation model is used to filter and label image measurements of the area image of the component to be detected, and the least squares method is used to fit the base surface and data enhancement technology to improve detection accuracy and efficiency.

Benefits of technology

It effectively improves the accuracy and efficiency of component pin exposed defect detection, reduces the missed detection and overkill rate, and meets the needs of industrial production for detection accuracy and real-time performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118071759B
    Figure CN118071759B
Patent Text Reader

Abstract

The present invention provides a method, device and electronic device for detecting exposed pin defects of components, the method comprising: obtaining a regional image of a component to be detected; filtering the regional image based on a preset 3D detection algorithm to obtain a first image; inputting the first image into a pre-acquired reasoning model to output a label image corresponding to the first image through the reasoning model; the reasoning model is determined based on a deep learning reasoning tool and a pre-trained semantic segmentation model; if the label image includes an exposed pin area, the size and position of the exposed pin area are measured according to the preset industrial production needs and a 2D detection algorithm to obtain a measurement result; based on the measurement result and the preset index, it is determined whether the component to be detected has an exposed pin defect. This method effectively improves the detection accuracy and efficiency by combining the 2D detection algorithm, the 3D detection algorithm, the reasoning model and the specific industrial scenario.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of industrial visual inspection, and in particular to a method, a device and an electronic device for detecting exposed defects of component pins. Background Art

[0002] Currently, the Automatic Optical Inspection System (AOI) is widely used in the field of electronic component manufacturing and inspection. However, due to the diversity, randomness, low contrast and complex background of the exposed area of ​​the NTC pin, the traditional 2D detection algorithm has problems with low detection accuracy and speed during the detection process. Summary of the invention

[0003] In view of this, the purpose of the present invention is to provide a method, device and electronic device for detecting exposed defects of component pins, so as to combine 2D detection algorithms, 3D detection algorithms and reasoning models with specific industrial scenarios, so as to effectively improve detection accuracy and efficiency.

[0004] The present invention provides a method for detecting exposed pin defects of a component, the method comprising:

[0005] Acquire a regional image of the component to be inspected;

[0006] Filtering the regional image based on a preset 3D detection algorithm to obtain a first image;

[0007] Inputting the first image into a pre-acquired inference model to output a label image corresponding to the first image through the inference model; wherein the inference model is determined based on a deep learning inference tool and a pre-trained semantic segmentation model;

[0008] If the label image includes an exposed pin area, the size and position of the exposed pin area are measured according to the preset industrial production requirements and 2D detection algorithm to obtain a measurement result;

[0009] Based on the measurement results and preset indicators, determine whether the component to be inspected has a lead exposure defect.

[0010] Furthermore, the step of filtering the regional image based on a preset 3D detection algorithm to obtain the first image includes:

[0011] Obtain 3D point cloud data of the component to be inspected;

[0012] The regional image is filtered based on the 3D point cloud data and the least square method to obtain a first image.

[0013] Furthermore, the 3D point cloud data includes a plurality of data points, and the step of filtering the regional image based on the 3D point cloud data and the least squares method to obtain the first image includes:

[0014] Determine the target data point and the target coordinate value corresponding to the target data point based on the 3D point cloud data;

[0015] Based on the target coordinate values, the target data points are fitted using the least square method to obtain the fitting base surface;

[0016] Selecting a maximum Z coordinate value from coordinate values ​​corresponding to a plurality of data points, and determining a data point to be filtered based on the maximum Z coordinate value and a fitting base surface, wherein the Z coordinate value of the data point to be filtered is greater than the fitting base surface and less than a preset threshold value; the preset threshold value is determined according to the maximum Z coordinate value;

[0017] Filter the 3D point cloud data based on the data points to be filtered to obtain target 3D point cloud data;

[0018] The regional image is filtered based on the target 3D point cloud data to obtain a first image.

[0019] Furthermore, the semantic segmentation model is trained in the following way:

[0020] Acquire a sample image; wherein the sample image is pre-marked with a background area label, a solder area label, and a pin exposed area label;

[0021] Divide the sample images into data sets according to a preset ratio; wherein the data sets include: a training set, a validation set, and a test set;

[0022] Preprocessing the data set to obtain a target data set; wherein the target data set includes: a target training set, a target verification set, and a target test set;

[0023] Iteratively train the pre-built semantic segmentation network based on the target training set and the target validation set to obtain a second semantic segmentation model;

[0024] Based on the target test set, the second semantic segmentation model is tested to obtain the test results;

[0025] If the test result indicates that the second semantic segmentation model meets the preset model evaluation index, determining the second semantic segmentation model as the semantic segmentation model;

[0026] If the test result indicates that the second semantic segmentation model does not meet the preset model evaluation index, the step of obtaining the sample image is continued until the second semantic segmentation model meets the preset model evaluation index to obtain the semantic segmentation model.

[0027] Furthermore, the step of iteratively training the pre-built semantic segmentation network based on the target training set and the target verification set to obtain the second semantic segmentation model includes:

[0028] Iteratively train the pre-built semantic segmentation network based on the target training set to obtain a first semantic segmentation model;

[0029] Verify the first semantic segmentation model based on the target verification set to obtain a verification result;

[0030] If the verification result indicates that the first semantic segmentation model does not meet the preset model evaluation indicators, the hyperparameters are adjusted and the step of iteratively training the pre-constructed semantic segmentation network based on the target training set to obtain the first semantic segmentation model is continued until the first semantic segmentation model meets the preset model evaluation indicators to obtain the second semantic segmentation model.

[0031] Furthermore, the steps of preprocessing the data set to obtain the target data set include:

[0032] Normalizing the data set using a preset processing method to obtain a normalized data set;

[0033] The normalized data set is enhanced by using a variety of data enhancement methods to obtain the target data set; the data enhancement methods include: horizontal flipping, random cropping, random brightness change, rotation, contrast adjustment and scaling.

[0034] Furthermore, the semantic segmentation network is constructed in the following way:

[0035] Based on the Hard Net network and deep separation convolution, a semantic segmentation network is constructed.

[0036] The present invention provides a device for detecting exposed defects of component pins, the device comprising:

[0037] An acquisition module, used for acquiring a regional image of a component to be detected;

[0038] A filtering module, used for filtering the regional image based on a preset 3D detection algorithm to obtain a first image;

[0039] An output module, used to input the first image into a pre-acquired reasoning model to output a label image corresponding to the first image through the reasoning model; wherein the reasoning model is determined based on a deep learning reasoning tool and a pre-trained semantic segmentation model;

[0040] A measurement module, for measuring the size and position of the exposed pin area according to preset industrial production requirements and 2D detection algorithms to obtain a measurement result if the label image includes the exposed pin area;

[0041] The judgment module is used to judge whether the component to be inspected has a pin exposure defect based on the measurement results and preset indicators.

[0042] An electronic device provided by the present invention includes a memory and a processor. The memory stores a computer program that can be run on the processor. When the processor executes the computer program, the steps of any of the above-mentioned component pin exposure defect detection methods are implemented.

[0043] The present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned component pin exposure defect detection methods are executed.

[0044] The present invention provides a method, device and electronic device for detecting exposed pin defects of components, the method comprising: obtaining a regional image of a component to be detected; filtering the regional image based on a preset 3D detection algorithm to obtain a first image; inputting the first image into a pre-acquired reasoning model to output a label image corresponding to the first image through the reasoning model; the reasoning model is determined based on a deep learning reasoning tool and a pre-trained semantic segmentation model; if the label image includes an exposed pin area, the size and position of the exposed pin area are measured according to the preset industrial production needs and 2D detection algorithm to obtain a measurement result; based on the measurement result and preset indicators, it is determined whether the component to be detected has an exposed pin defect. This method effectively improves the detection accuracy and efficiency by combining the 2D detection algorithm, the 3D detection algorithm, the reasoning model and the specific industrial scenario. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0046] Figure 1 A flowchart of a method for detecting exposed pin defects of a component provided by an embodiment of the present invention;

[0047] Figure 2 Another schematic diagram of a regional image provided by an embodiment of the present invention;

[0048] Figure 3 A flow chart of another method for detecting exposed component pin defects provided by an embodiment of the present invention;

[0049] Figure 4A schematic diagram of a regional image provided by an embodiment of the present invention;

[0050] Figure 5 A schematic diagram of a first image provided by an embodiment of the present invention;

[0051] Figure 6 A schematic diagram of a sample image provided by an embodiment of the present invention;

[0052] Figure 7 A schematic diagram of the structure of a deep separation convolution provided by an embodiment of the present invention;

[0053] Figure 8 Another schematic diagram of a regional image provided by an embodiment of the present invention;

[0054] Fig. 9 A schematic diagram of a label image provided by an embodiment of the present invention;

[0055] Fig.10 A schematic diagram of a measurement result provided by an embodiment of the present invention;

[0056] Fig.11 A schematic diagram of a component lead exposed defect detection process provided by an embodiment of the present invention;

[0057] Fig.12 A schematic structural diagram of a device for detecting exposed pin defects of a component provided by an embodiment of the present invention;

[0058] Fig.13 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0059] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0060] With the rapid development of new energy vehicles, higher demands are placed on high-performance and reliable electronic connection solutions. In new energy vehicles, the acquisition line in the battery management system (BMS) can monitor the voltage, temperature, current in and out of each battery cell in real time and help the BMS obtain the battery charge and discharge status, so that the BMS can formulate and optimize the charge and discharge strategy to extend the battery life and improve energy efficiency. Flexible printed circuit (FPC) is a flexible circuit that can be bent and folded at will. It is light in weight, small in size, has good heat dissipation, and is easy to install. It breaks through the traditional interconnection technology and makes full use of space, thus gradually replacing the traditional acquisition line. At the same time, because the size of the negative temperature coefficient thermistor (NTC) is closer to the battery cell being tested and has a simplified installation structure, it further improves the advantages of PFC. Therefore, in the combined charging system (CCS), FPC generally adopts chip NTC. At present, the quality inspection of FPC in China still mainly relies on manual visual inspection, which is not only costly but also inefficient. With the rapid development of the electronics industry, the design of circuit boards is becoming more and more high-density and high-precision. Traditional manual inspection can no longer meet the current production needs. Automated inspection of FPC defects has become an inevitable trend in industrial development. In the field of industrial manufacturing, the automatic optical inspection system (AOI) is particularly widely used in the field of electronic component manufacturing and inspection, but the traditional 2D optical inspection system mainly faces the following two major problems:

[0061] 1. Lack of three-dimensional data: For double-layer FPC, multi-layer FPC and rigid-flex boards, some defects are missed; three-dimensional structural defects cannot be effectively detected, such as insufficient solder joint volume or three-dimensional deformation of components.

[0062] 2. Insufficient accuracy of traditional 2D visual inspection algorithms: As electronic components become smaller, functions become more complex, and processing techniques continue to change, 2D images show characteristics such as reduced contrast and increased background complexity, which in turn leads to a decrease in the detection accuracy of traditional 2D visual algorithms in some special scenes. At the same time, 2D inspection systems rely on light uniformity and contrast to detect defects, but reflections or special colors can also lead to a decrease in detection accuracy.

[0063] Due to the existence of the above problems, the traditional 2D automatic optical inspection system has too many missed detections and over-detection phenomena during the FPC defect detection process, and thus cannot meet the production inspection needs of enterprises.

[0064] Specifically, when connecting NTC in FPC, the pins of NTC may be offset outside the solder area or float to the surface of the solder area due to pin bending, damage, uneven soldering, insufficient soldering, mechanical stress changes before and after soldering, and insufficient assembly accuracy, resulting in unstable connection and affecting the reliability of the circuit. Therefore, it is necessary to detect the exposed area of ​​the NTC pins.

[0065] Due to the diversity, randomness, low contrast and complex background of the exposed area of ​​the NTC pin, the traditional 2D detection algorithm has problems to varying degrees during the detection process:

[0066] When testing the exposed pin area based on template matching, using a single template can only detect defects where all pins are exposed, but lacks the ability to detect defects where only some pins are exposed; adding too many templates will lead to a decrease in detection speed on the one hand, and increase the risk of over-killing on the other hand.

[0067] When detecting exposed pin areas based on color detection and threshold segmentation, due to factors such as the low grayscale contrast between the pins and the solder and the reflection of the flux in the background, the algorithm detects part of the solder as exposed pins, resulting in an over-killing problem.

[0068] When detecting the exposed pin area based on texture feature extraction and SVM, the feature dimension is much higher than the number of samples due to excessive noise, causing the SVM classifier to overfit. It also regards part of the solder as exposed pins, resulting in over-killing.

[0069] In summary, relying solely on traditional 2D detection methods cannot meet the requirements for accuracy and speed of NTC pin exposure detection in actual industrial production.

[0070] Based on this, an embodiment of the present invention provides a method, device and electronic device for detecting exposed component pin defects. This technology can be applied to applications that require detection of exposed component pin defects, especially to applications that require detection of exposed NTC pin areas.

[0071] To facilitate understanding of this embodiment, a method for detecting exposed pin defects of a component disclosed in an embodiment of the present invention is first described in detail. Figure 1 As shown, the method comprises the following steps:

[0072] Step S102, obtaining a regional image of the component to be inspected.

[0073] The regional image of the above-mentioned detection element can be in different forms such as a photo or a picture. In actual implementation, when it is necessary to detect the exposed pin defect of the detection element, it is usually necessary to first obtain the regional image of the component to be detected.

[0074] The regional image of the component to be inspected may generally include three parts: a background area, a solder area, and a lead exposed area.

[0075] Specifically, the component to be detected may be a NTC (Negative Temperature Coefficient, negative temperature coefficient thermistor). In actual implementation, a high-resolution 2D camera may be used to capture images of the NTC component region in real time.

[0076] Step S104: filtering the regional image based on a preset 3D detection algorithm to obtain a first image.

[0077] In actual implementation, if there are many interferences such as reflections and white stripes in the background area of ​​the regional image of the component to be detected captured by the 2D camera, 3D point cloud data can also be obtained and the base surface can be fitted using the least squares method. The area to be filtered is determined based on the fitted base surface and preset values, and then the area to be filtered in the regional image is filtered out to obtain the first image, thereby reducing the impact of the background on the segmentation result.

[0078] Step S106, inputting the first image into a pre-acquired reasoning model to output a label image corresponding to the first image through the reasoning model; wherein the reasoning model is determined based on a deep learning reasoning tool and a pre-trained semantic segmentation model.

[0079] The above inference model can be obtained by inferring a pre-trained semantic segmentation model through a deep learning inference tool. The above deep learning inference tool can adopt the TensorRT framework (a high-performance inference C++ library that only supports inference but not training).

[0080] In the specific implementation process, the trained semantic segmentation model is optimized for iteration speed and flexibility, occupies a lot of memory and computing resources, and does not fully utilize specific hardware optimization features, so it is generally not convenient to use directly. By using the TensorRT framework to deploy the semantic segmentation model inference model, the trained semantic segmentation model can be decomposed and then fused. The fused model (equivalent to the above inference model) has a high degree of aggregation. For example, after the convolution layer and the activation layer are fused, the pin exposure defect is calculated, the computing efficiency is improved, and multi-precision deployment is supported to further improve the efficiency of pin exposure area detection.

[0081] Step S108: if the label image includes an exposed pin area, the size and position of the exposed pin area are measured according to preset industrial production requirements and a 2D detection algorithm to obtain a measurement result.

[0082] In fact, in the label image output by the inference model, the area corresponding to the pixel with a pixel value of 0 is the background area, the area corresponding to the pixel with a pixel value of 1 is the back solder area 1, and the area corresponding to the pixel with a pixel value of 2 is the exposed pin area.

[0083] If the output label image includes the exposed pin area, the outline of the exposed NTC pin area can be obtained according to the first calculation method;

[0084] The first calculation method can be expressed as follows:

[0085]

[0086] in, Indicates that the coordinate value in the first input image is The pixel value corresponding to the pixel point, lowerb is the lower threshold, and upperb is the upper threshold.

[0087] Therefore, when the lower threshold in the first calculation method is set to 2 and the lower threshold is set to 3, the outline of the exposed area of ​​the NTC pin can be obtained by the first calculation method;

[0088] Then, the target pin exposure area can be determined according to the preset industrial production needs and the contour of the NTC pin exposure area;

[0089] The above industrial production needs are also the needs of the actual industrial application environment, and can be set according to the needs of the actual industrial application environment. For example, some users do not consider whether there is a pin exposed on the top of the component, that is, when there is a pin exposed area on the top of the component, the pin exposed area on the top needs to be shielded. Therefore, the above industrial production needs can be understood as a shielding area. If the outline of the pin exposed area shows that there is a first exposed area located at the top of the component in the pin exposed area (see Figure 2 ), the first leakage area located at the top of the component in the pin exposed area can be shielded to obtain the target pin exposed area.

[0090] Specifically, after the inference model performs semantic segmentation on the NTC area image, it is only responsible for segmenting the area where the pins may be exposed. However, some customers do not care whether the top area of ​​the NTC component has exposed pins. Therefore, after obtaining the contour of the NTC pin exposed area, it is necessary to use a 2D algorithm to shield the top area to obtain the target pin exposed area. The top area will not be calculated in the subsequent measurement (detection) of the exposed pin length and position of the target pin exposed area.

[0091] After the target pin exposed area is obtained, a 2D detection algorithm may be used to measure the size and position of the target pin exposed area to obtain a measurement result.

[0092] The above 2D detection algorithm is a traditional 2D detection algorithm. For details, please refer to the 2D detection algorithm in the related art.

[0093] In actual implementation, the size and position of the target pin exposure area can be measured using a traditional 2D detection algorithm, and whether there is a pin exposure defect that affects the NTC connection quality can be determined based on preset indicators.

[0094] Step S110: Based on the measurement result and the preset index, it is determined whether the component to be inspected has a lead exposure defect.

[0095] The above-mentioned preset indicators may include an upper limit value of the exposed pin length (first target value) corresponding to when the bottom position of the target pin exposed area is not lower than the bottom position of the solder area, and an upper limit value of the exposed pin length (second target value) corresponding to when the bottom position of the target pin exposed area is lower than the bottom position of the solder area; specifically, NTC pins have production standards. For example, for a 5.5mm pin, some users think that 3mm exposure is unacceptable, while others think that 2mm exposure is unacceptable. Therefore, an upper limit of exposure will be preset as the first target value based on customer needs. If the measurement result indicates that the bottom position of the target pin exposed area of ​​a component is not lower than the bottom position of the solder area, and the length of the target pin exposed area (pin exposure length) exceeds the first target value, it can be considered that the component is a problematic component, that is, there is a pin exposure defect that affects the NTC connection quality.

[0096] Some pins have the problem of bottom protrusion. For example, the bottom position of the exposed area of ​​the pin is lower than the bottom position of the solder area (that is, the pin is offset outside the solder area), but its exposed length of the pin may be only 0.3mm, which is much smaller than the first target value. Therefore, it is necessary to calculate the positional relationship between the bottom of the pin and the bottom of the solder through a 2D algorithm. If the bottom of the pin protrudes, the exposed length of the bottom will also be calculated. If it exceeds the second target value, it is also considered that there is a pin exposure defect that affects the quality of the NTC connection. In specific implementation, if the measurement result indicates that the bottom position of the target pin exposed area of ​​a component is lower than the bottom position of the solder area (see, for example, Figure 2 If the length of the target pin exposed area (the length of the pin exposed area at this time can be understood as the length of the second pin exposed area, specifically, the area below the bottom position of the solder area in the target pin exposed area can be first determined as the second pin exposed area, and then the measured length of the second pin exposed area can be determined as the length of the target pin exposed area) exceeds the second target value, it can also be considered that the component is a problematic component and has a pin exposure defect that affects the NTC connection quality.

[0097] Semantic segmentation technology based on deep learning learns complex features from data through multi-layer neural networks, from basic edges and textures to advanced object shapes and contextual relationships. This enables the semantic segmentation model to understand and adapt to diverse scenarios. The trained semantic segmentation model shows strong generalization ability and can adapt to a variety of environments including unknown scenarios, improving detection accuracy; but there are still problems with using only semantic segmentation models:

[0098] Complex image processing tasks require deeper and more complex network structures, which will reduce the efficiency of detection. In order to balance detection accuracy and speed, the image passed into the neural network can be pre-filtered by a 3D detection algorithm to reduce the impact of the background on the segmentation task, thereby simplifying the network structure and speeding up the network reasoning. In addition, after the semantic segmentation of the NTC area image, only the location of the exposed area of ​​the NTC pin can be achieved, but its shape, size and position cannot be measured. It is also difficult to carry out targeted detection in combination with the needs of actual industrial production. Therefore, it is necessary to combine the traditional 2D detection algorithm to further adapt to the actual needs of NTC connection defect detection.

[0099] A method for detecting exposed pin defects of components provided by an embodiment of the present invention includes: obtaining a regional image of a component to be detected; filtering the regional image based on a pre-set 3D detection algorithm to obtain a first image; inputting the first image into a pre-acquired reasoning model to output a label image corresponding to the first image through the reasoning model; the reasoning model is determined based on a deep learning reasoning tool and a pre-trained semantic segmentation model; if the label image includes an exposed pin area, the size and position of the exposed pin area are measured according to the pre-set industrial production needs and 2D detection algorithm to obtain a measurement result; based on the measurement result and the preset index, it is determined whether the component to be detected has an exposed pin defect. This method effectively improves the detection accuracy and efficiency by combining the 2D detection algorithm, the 3D detection algorithm, the reasoning model and the specific industrial scenario.

[0100] The embodiment of the present invention provides another method for detecting exposed pin defects of components, which is implemented on the basis of the method of the above embodiment; Figure 3 As shown, the method comprises the following steps:

[0101] Step S202, obtaining a regional image of the component to be inspected.

[0102] Furthermore, the step of filtering the regional image based on a preset 3D detection algorithm to obtain the first image includes:

[0103] Step S204, obtaining 3D point cloud data of the component to be inspected.

[0104] In the specific implementation process, a high-resolution 3D camera can be used to capture images of the NTC component area to obtain a 3D area image, and 3D point cloud data can be obtained based on the 3D area image. The 3D point cloud data includes multiple data points and the coordinate value of each data point (the coordinate value of each data point includes an X coordinate value, a Y coordinate value, and a Z coordinate value).

[0105] Step S206 , filtering the regional image based on the 3D point cloud data and the least squares method to obtain a first image.

[0106] Specifically, the above step S204 can be implemented by following the steps 1 to 5:

[0107] Step 1: Determine the target data point and the target coordinate value corresponding to the target data point based on the 3D point cloud data.

[0108] The above target data point (ie, base surface point) can be understood as a data point with a Z coordinate value of 0, that is, the Z coordinate value in the target coordinate value of the target data point is 0.

[0109] Step 2: Based on the target coordinate values, the target data points are fitted using the least squares method to obtain the fitting base surface.

[0110] The formula corresponding to the above least squares method is as follows:

[0111]

[0112] Where n is the number of target data points, is the target coordinate value of the i-th target data point, is the independent variable of the i-th target data point, is the fitting function.

[0113] Step 3: Select the maximum Z coordinate value from the coordinate values ​​corresponding to multiple data points, and determine the data points to be filtered based on the maximum Z coordinate value and the fitting base surface, wherein the Z coordinate value of the data points to be filtered is greater than the fitting base surface and less than a preset threshold; the preset threshold is determined according to the maximum Z coordinate value.

[0114] In actual implementation, the preset threshold value can be determined according to the selected maximum Z coordinate value, wherein the preset threshold value is generally smaller than the maximum Z coordinate value, for example, it can be one third of the maximum Z coordinate value;

[0115] The least squares method is used to fit the base surface, and then the part above the base surface and below the preset value is filtered to reduce the impact of the background on the segmentation result.

[0116] Step 4: Filter the 3D point cloud data based on the data points to be filtered to obtain the target 3D point cloud data.

[0117] Specifically, after determining the data points to be filtered, the Z coordinate values ​​corresponding to the data points to be filtered in the 3D point cloud data can be changed to 0 to obtain the target 3D point cloud data; wherein the target 3D point cloud data includes the filtered data points whose Z coordinate values ​​are changed to 0 and other data points in the 3D point cloud data except the filtered data points.

[0118] Step 5: Filter the regional image based on the target 3D point cloud data to obtain a first image.

[0119] The above-mentioned regional image includes 2D point cloud data. Therefore, the X coordinates and Y coordinates corresponding to the filtered data points in the target 3D point cloud data can be matched with the 2D point cloud data to obtain the filtered data points in the 2D point cloud data. The filtered data points in the 2D point cloud data are determined as data points in the background area to obtain the first image. For details, please refer to Figure 4 An area image is shown, and Figure 4 The first image obtained after filtering the regional image in can be Figure 5 shown.

[0120] Step S208: input the first image into a pre-acquired reasoning model to output a label image corresponding to the first image through the reasoning model; wherein the reasoning model is determined based on a deep learning reasoning tool and a pre-trained semantic segmentation model.

[0121] Specifically, the semantic segmentation model can be trained through the following steps 6 to 11:

[0122] Step 6: Obtain a sample image; wherein the sample image is pre-marked with a background area label, a solder area label, and a pin exposed area label.

[0123] The above sample images are used to iteratively train the semantic segmentation network; the above background area label can be understood as the result of labeling the data points in the background area of ​​the sample image, such as the background area label can be 0; the above solder area label can be understood as the result of labeling the data points in the solder area of ​​the sample image, such as the solder area label can be 1; the above pin exposed area label is the result of labeling the data points in the pin exposed area of ​​the sample image, such as the pin exposed area label can be 2.

[0124] The above-mentioned background area labels, solder area labels, and pin exposed area labels can be labeled in a suitable manner according to actual needs; in actual implementation, when it is necessary to train the semantic segmentation network, it is usually necessary to collect a large number of original images, and manually label the original images to obtain sample images; for example, a high-resolution 2D camera is used to collect 630 original images of the NTC area, and they are manually labeled as background area 0, solder area 1, and NTC pin area 2 to obtain sample images. For details, please refer to Figure 6 A sample image is shown; then the sample image can be divided into a training set: a validation set: a test set according to a preset ratio of 621:6:3.

[0125] Step 7: Divide the sample images into data sets according to a preset ratio; wherein the data sets include: a training set, a validation set, and a test set.

[0126] Step 8: Preprocess the data set to obtain a target data set; wherein the target data set includes: a target training set, a target verification set, and a target test set.

[0127] Specifically, the above step eight can be implemented by following steps A to B:

[0128] Step A: Normalize the data set using a preset processing method to obtain a normalized data set.

[0129] Step B: Use multiple data enhancement methods to perform data enhancement processing on the normalized data set to obtain the target data set; wherein the data enhancement methods include: horizontal flipping, random cropping, random brightness change, rotation, contrast adjustment and scaling.

[0130] In actual implementation, the training data (including training set, validation set and test set) can be uniformly normalized using the same data preprocessing method as the pre-training weights. At the same time, the training data set can be enhanced using horizontal flipping, random cropping, random brightness change, rotation, contrast adjustment and scaling to obtain the target training set, target validation set and target test set to meet the needs of different production environments and avoid overfitting.

[0131] Step 9: Iteratively train the pre-built semantic segmentation network based on the target training set and the target validation set to obtain the second semantic segmentation model.

[0132] The above semantic segmentation network can be constructed based on the Hard Net network and deep separation convolution. Specifically, HarDNet (Harmonic DenseNet) can be understood as an image classification algorithm, which can optimize the flow of information through its unique "harmonic connection", effectively reduce the redundancy in information transmission, accelerate the calculation process, and reduce memory requirements. It is particularly suitable for real-time processing and resource-constrained devices. It has demonstrated good generalization capabilities in a variety of tasks such as image classification and object detection. In addition, HarDNet reduces complexity by reducing model parameters, which helps prevent overfitting, making it an efficient and flexible choice for processing computationally intensive tasks. Its "connection" process can be expressed by the following formula:

[0133]

[0134] Among them, ⨁ represents feature fusion or connection, and k|n means that k is a factor of n (except n).

[0135] Building a semantic segmentation network based on HarDNet39DS and deep separation convolution can enable the network to maintain a high segmentation accuracy, while further reducing the computational burden and model size, and speeding up the detection of exposed pins.

[0136] Specifically, the structure of the above-mentioned deep separation convolution is as follows Figure 7As shown in the figure, the depth separation convolution consists of two parts: DepthwiseConvolution and PointwiseConvolution. The calculation of DepthwiseConvolution is very simple. It uses a convolution kernel for each channel of the input feature map, and then concatenates the outputs of all convolution kernels to get its final output, as shown in the figure. Figure 7 As shown in the Depthwise Convolution section of . Pointwise Convolution is actually a 1×1 convolution, which plays two roles in the depth separation convolution. The first role is to allow DSC to freely change the number of output channels; the second role is to perform channel fusion on the feature map output by DepthwiseConvolution; from the above, we can see that the computational efficiency of depth separation convolution is much better than that of ordinary convolution.

[0137] The above step nine can be implemented by following steps C to D:

[0138] Step C: iteratively training the pre-built semantic segmentation network based on the target training set to obtain a first semantic segmentation model;

[0139] The target training set can be used as a sample set for training, and is mainly used to train the parameters in the semantic segmentation network. In actual implementation, after iterative training of the pre-constructed semantic segmentation network based on the target training set, an initial semantic segmentation model can be obtained. If the initial semantic segmentation model does not converge, the weight parameters of the initial semantic segmentation model are updated, and the initial semantic segmentation model is used as the new semantic segmentation network. The steps of iterative training of the pre-constructed semantic segmentation network based on the target training set and the target validation set are continued to obtain the initial semantic segmentation model until the initial semantic segmentation model converges to obtain the first semantic segmentation model.

[0140] Specifically, the image data corresponding to the target training set can be passed into the semantic segmentation network for training. Some hyperparameters and results are shown in Table 1:

[0141] Table 1 Training hyperparameters and training results

[0142]

[0143] The above weighted cross entropy loss is as follows:

[0144]

[0145] in, is the weight of the positive class, is the weight of the negative class; Indicates the label of sample i, the positive class is 1 and the negative class is 0; It represents the probability that sample i is predicted to be a positive class.

[0146] Backpropagating the output error to the network parameters to fit the output of the sample is essentially an optimization process that gradually tends to the optimal solution. However, the amount of error used in each parameter update needs to be determined by a parameter, which is the learning rate, also known as the step size.

[0147] Batch_size indicates the number of data (samples) passed to the program for training at one time. For example, if the training set has 800 data, and batch_size=8 is set, the program will first use the first 8 parameters in the data set, that is, the 1st to 8th data, to train the model. After the training is completed, the weights are updated, and then the 9th to 16th data are used for training, and the training stops after the 800 data in the training set are used for the 100th time.

[0148] Step D: Verify the first semantic segmentation model based on the target verification set to obtain a verification result.

[0149] Step E: If the verification result indicates that the first semantic segmentation model does not meet the preset model evaluation indicators, adjust the hyperparameters and continue to iteratively train the pre-constructed semantic segmentation network based on the target training set to obtain the first semantic segmentation model, until the first semantic segmentation model meets the preset model evaluation indicators to obtain the second semantic segmentation model.

[0150] The target validation set is used to adjust the hyperparameters of the first semantic segmentation model and to preliminarily evaluate the performance of the first semantic segmentation model. By adjusting the hyperparameters on the target validation set, the most suitable hyperparameter combination for the first semantic segmentation model parameters can be found, thereby improving the performance of the first semantic segmentation model on the target training set.

[0151] The above-mentioned preset model evaluation indicators may include Miou (the mean of intersection-over-union ratios of different categories, where the solder segmentation accuracy in the above Table 1 is the mean of one category of intersection-over-union ratios, and the pin segmentation accuracy is the mean of another category of intersection-over-union ratios) and F1Score (calculated based on recall rate and precision rate, the higher the value, the better the model performance); when the target training set is trained, the first semantic segmentation model can be obtained, and then the first semantic segmentation model can be verified using the target verification set, and a confusion matrix is ​​obtained based on the classification result of the first semantic segmentation model; Miou and F1 Score are calculated based on the confusion matrix; if Miou is greater than the preset first indicator threshold and F1 Score is greater than the preset second indicator threshold, it is considered that the preset model evaluation indicators are met.

[0152] Step 10: Based on the target test set, test the second semantic segmentation model to obtain the test results.

[0153] Step 11: If the test result indicates that the second semantic segmentation model meets the preset model evaluation index, the second semantic segmentation model is determined as the semantic segmentation model.

[0154] Step 12: If the test result indicates that the second semantic segmentation model does not meet the preset model evaluation index, continue to execute the step of obtaining the sample image until the second semantic segmentation model meets the preset model evaluation index to obtain the semantic segmentation model.

[0155] If the Miou calculated based on the confusion matrix generated based on the test results is greater than the preset first indicator threshold and the F1Score is greater than the preset second indicator threshold, it is considered that the preset model evaluation indicators are met.

[0156] The target test set is used to finally evaluate the performance of the second semantic segmentation model. That is, the data in the target test set is not seen by the model during the training and verification process, so it can be used to test whether the second semantic segmentation model can be generalized to new data. The performance evaluation results of the target test set can more accurately reflect the performance of the second semantic segmentation model in practical applications.

[0157] In fact, after the semantic segmentation model is trained, it can be deployed using the TensorRT framework to obtain an inference model.

[0158] Step S210: If the label image includes an exposed pin area, the size and position of the exposed pin area are measured according to a preset industrial production requirement and a 2D detection algorithm to obtain a measurement result.

[0159] Step S212: based on the measurement result and the preset index, determine whether the component to be inspected has a lead exposure defect.

[0160] Specifically, an image of the NTC area can be passed into a segmentation network to obtain a label image, in which the pixel values ​​of the background, solder and pin are 0, 1 and 2 respectively, and the outline of the exposed area of ​​the NTC pin is obtained by the first calculation method; according to the needs of the actual industrial application environment, a 2D detection algorithm is used to measure the size and position of the exposed area of ​​the NTC pin, and according to preset indicators, it is determined whether there is a real pin exposure defect that affects the NTC connection quality.

[0161] In actual implementation, among 1218 test data actually collected, when the method for detecting exposed component pin defects provided in this embodiment is used for detection, the exposed pin segmentation accuracy can reach 93.6%; after the actual detection process integrates 3D and 2D algorithms and optimizes the scene, the missed detection rate reaches 0.0%, the over-kill rate is 0.3%, and the average detection time for a single image is 11ms.

[0162] As an example, suppose that Figure 8 The region image shown is input into the inference model, and the corresponding label image (segmentation result) can be obtained as follows Fig. 9 As shown, according to the preset industrial production needs, the first calculation method and the 2D detection algorithm Fig. 9 After measuring the size and position of the exposed area of ​​the pin, the obtained measurement result diagram (i.e., the detection result image) can be shown as follows Fig.10 shown.

[0163] For a better understanding of the above embodiments, please refer to Fig.11 The schematic diagram of the component pin exposure defect detection process shown in the figure first needs to train the NTC pin exposure semantic segmentation model (equivalent to the training semantic segmentation model), and then detect the NTC pin exposure defect online; the training process includes collecting NTC area data (equivalent to 2D data), annotating the 2D data into three parts: background, solder, and pin to obtain a sample image (equivalent to TrainMask), normalizing and enhancing the sample image to obtain a target data set, building a semantic segmentation network and passing it into the target data set (equivalent to train data) to train the network, and obtaining the Miou F1 through continuous iteration and parameter adjustment. Score's semantic segmentation model; then use TensorRT to deploy the NTC pin exposure model; online detection of NTC pin exposure defects includes real-time acquisition of NTC area images and 3D point cloud data, determining whether to use 3D point cloud data to filter the NTC area background, if so, using 3D point cloud data to generate a height map, filtering the 2D point cloud data in the NTC area image, passing the filtered NTC area image into the inference network (inference model), segmenting the pin exposure area, and using the 2D image algorithm to measure the size of the pin exposure area according to the segmentation result label (label image), and determining whether the measured value of the pin (equivalent to the pin) exposure is greater than the threshold (preset indicator). If it is greater than, it is considered that the pin is exposed, and if it is not greater than, it is considered that the pin is not exposed.

[0164] The present embodiment provides a method for detecting the exposed pin defect of a component. First, a high-resolution 2D camera is used to capture an image of the NTC component area. The 2D image is manually labeled into three areas: background, solder, and exposed NTC pins, thereby obtaining label data. Secondly, the 2D image and label data are passed in pairs to the semantic segmentation model for training to obtain the optimal semantic segmentation model and deployed through the inference framework; then, the image to be passed into the segmentation network is filtered using 3D point cloud information to further weaken the interference of complex background on the segmentation result; finally, the size of the exposed area of ​​the NTC pin is measured using the 2D detection algorithm and actual production needs to further detect whether there are actually defects that affect the connection performance. This method combines traditional 2D detection algorithms, 3D detection algorithms, and semantic segmentation algorithms with specific industrial scenarios. It can effectively solve the problem that the traditional 2D algorithm cannot accurately detect exposed NTC pins due to the complex detection environment. The detection capability of NTC connection defects is improved, and the problem of insufficient detection capability caused by the diversity of exposed NTC pin morphology, insufficient contrast, and poor real-time detection faced during the detection process is effectively solved. It meets the requirements for accuracy and real-time performance during the detection process, effectively improves the detection accuracy and efficiency, and provides a reference for the detection of other similar products.

[0165] Furthermore, the present embodiment provides a method for detecting component pin exposure defects. After manually and accurately marking a label data set of some NTC pin exposure, a variety of data enhancement methods are used to simulate the scenarios that may be encountered in the actual detection process, which greatly expands the types of data sets. At the same time, the labeling process is simplified, greatly saving labeling manpower and time.

[0166] Furthermore, the present embodiment provides a method for detecting exposed component pin defects, which uses a 3D algorithm to pre-filter the image passed into the AI ​​algorithm, thereby weakening the interference of the image background on the segmentation task, reducing the complexity of the network, and speeding up the detection of exposed NTC pins.

[0167] Furthermore, the method for detecting exposed pin defects of components provided in this embodiment uses a deep separation convolution structure to extract feature information, thereby ensuring the segmentation accuracy of exposed NTC pins. At the same time, the model is further lightweight, thereby accelerating the detection speed of the algorithm.

[0168] Furthermore, the method for detecting exposed component pin defects provided in this embodiment adopts a lightweight semantic segmentation model and TensorRT to infer the deployment model, ensuring the real-time performance of image acquisition, reasoning and measurement, and realizing end-to-end rapid detection.

[0169] The embodiment of the present invention provides a schematic diagram of the structure of a device for detecting exposed pin defects of a component. Fig.12As shown, the device includes: an acquisition module 111, used to acquire a regional image of a component to be inspected; a filtering module 112, used to filter the regional image based on a preset 3D detection algorithm to obtain a first image; an output module 113, used to input the first image into a pre-acquired inference model to output a label image corresponding to the first image through the inference model; wherein the inference model is determined based on a deep learning inference tool and a pre-trained semantic segmentation model; a measurement module 114, used to measure the size and position of the pin exposed area according to preset industrial production requirements and a 2D detection algorithm to obtain a measurement result if the label image includes a pin exposed area; and a judgment module 115, used to determine whether the component to be inspected has a pin exposed defect based on the measurement result and preset indicators.

[0170] The device for detecting the exposed pin defect of a component provided by the present invention comprises: obtaining a regional image of a component to be detected; filtering the regional image based on a preset 3D detection algorithm to obtain a first image; inputting the first image into a pre-acquired reasoning model to output a label image corresponding to the first image through the reasoning model; the reasoning model is determined based on a deep learning reasoning tool and a pre-trained semantic segmentation model; if the label image includes an exposed pin area, the size and position of the exposed pin area are measured according to the preset industrial production needs and the 2D detection algorithm to obtain a measurement result; based on the measurement result and the preset index, determining whether the component to be detected has an exposed pin defect. This method effectively improves the detection accuracy and efficiency by combining the 2D detection algorithm, the 3D detection algorithm, the reasoning model with a specific industrial scenario.

[0171] Furthermore, the filtering module is also used to obtain 3D point cloud data of the component to be detected; and filter the regional image based on the 3D point cloud data and the least square method to obtain a first image.

[0172] Furthermore, the 3D point cloud data includes multiple data points, and the filtering module is also used to determine the target data points and the target coordinate values ​​corresponding to the target data points based on the 3D point cloud data; based on the target coordinate values, the target data points are fitted using the least squares method to obtain a fitting base surface; the maximum Z coordinate value is selected from the coordinate values ​​corresponding to the multiple data points, and the data points to be filtered are determined based on the maximum Z coordinate value and the fitting base surface, wherein the Z coordinate value of the data points to be filtered is greater than the fitting base surface and less than a preset threshold; the preset threshold is determined according to the maximum Z coordinate value; the 3D point cloud data is filtered based on the data points to be filtered to obtain target 3D point cloud data; the regional image is filtered based on the target 3D point cloud data to obtain a first image.

[0173] Furthermore, the device also includes a training module for acquiring sample images; wherein the sample images are pre-marked with background area labels, solder area labels, and pin exposed area labels; the sample images are divided into data sets according to a preset ratio; wherein the data sets include: a training set, a validation set, and a test set; the data sets are preprocessed to obtain a target data set; wherein the target data set includes: a target training set, a target validation set, and a target test set; based on the target training set and the target validation set, a pre-constructed semantic segmentation network is iteratively trained to obtain a second semantic segmentation model; based on the target test set, the second semantic segmentation model is tested to obtain a test result; if the test result indicates that the second semantic segmentation model meets the preset model evaluation index, the second semantic segmentation model is determined as the semantic segmentation model; if the test result indicates that the second semantic segmentation model does not meet the preset model evaluation index, the step of acquiring the sample image is continued until the second semantic segmentation model meets the preset model evaluation index to obtain the semantic segmentation model.

[0174] Furthermore, the training module is also used to iteratively train a pre-constructed semantic segmentation network based on a target training set to obtain a first semantic segmentation model; verify the first semantic segmentation model based on a target verification set to obtain a verification result; if the verification result indicates that the first semantic segmentation model does not meet the preset model evaluation indicators, adjust the hyperparameters and continue to perform the steps of iteratively training the pre-constructed semantic segmentation network based on the target training set to obtain the first semantic segmentation model, until the first semantic segmentation model meets the preset model evaluation indicators to obtain the second semantic segmentation model.

[0175] Furthermore, the training module is also used to normalize the data set using a preset processing method to obtain a normalized data set; and to perform data enhancement processing on the normalized data set using a variety of data enhancement methods to obtain a target data set; wherein the data enhancement methods include: horizontal flipping, random cropping, random brightness change, rotation, contrast adjustment and scaling.

[0176] Furthermore, the training module is also used to construct a semantic segmentation network based on the Hard Net network and deep separation convolution.

[0177] The device for detecting exposed component pin defects provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment for detecting exposed component pin defects. For the embodiment of the device for detecting exposed component pin defects, reference may be made to the corresponding contents in the aforementioned method embodiment for detecting exposed component pin defects.

[0178] The embodiment of the present invention further provides an electronic device, see Fig.13As shown, the electronic device includes a processor 130 and a memory 131, wherein the memory 131 stores machine executable instructions that can be executed by the processor 130, and the processor 130 executes the machine executable instructions to implement the above-mentioned component pin exposure defect detection method.

[0179] Further, Fig.13 The electronic device shown further includes a bus 132 and a communication interface 133 , and the processor 130 , the communication interface 133 and the memory 131 are connected via the bus 132 .

[0180] The memory 131 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 133 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 132 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.13 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0181] The processor 130 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 130. The above processor 130 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 131, and the processor 130 reads the information in the memory 131 and completes the steps of the method of the above embodiment in combination with its hardware.

[0182] An embodiment of the present invention also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned method for detecting exposed component pin defects. The specific implementation can be found in the method embodiment, which will not be repeated here.

[0183] The method, device and electronic device for detecting exposed component pin defects provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.

[0184] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0185] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for detecting component lead exposure defects, characterized in that: The method comprises: Acquire a regional image of the component to be inspected; Filtering the regional image based on a preset 3D detection algorithm to obtain a first image; Input the first image into a pre-acquired inference model, so as to segment the first image into a background area, a solder area or an exposed pin area through the inference model, and different areas are represented by different pixel values, and output a label image corresponding to the first image; wherein the inference model is determined based on a deep learning inference tool and a pre-trained semantic segmentation model; If the label image includes an exposed pin area, the size and position of the exposed pin area are measured according to a preset industrial production requirement and a 2D detection algorithm to obtain a measurement result; Based on the measurement result and the preset index, determining whether the component to be inspected has a pin exposure defect; The step of filtering the regional image based on a preset 3D detection algorithm to obtain a first image includes: Obtain 3D point cloud data of the component to be inspected; Filtering the regional image based on the 3D point cloud data and a least squares method to obtain a first image; The 3D point cloud data includes a plurality of data points, and the step of filtering the regional image based on the 3D point cloud data and the least square method to obtain the first image includes: Determine a target data point and a target coordinate value corresponding to the target data point based on the 3D point cloud data; wherein the target data point is a data point with a Z coordinate value of 0; Based on the target coordinate values, the target data points are fitted using the least squares method to obtain a fitting base surface; Selecting a maximum Z coordinate value from coordinate values ​​corresponding to a plurality of data points, and determining a data point to be filtered based on the maximum Z coordinate value and the fitting base surface, wherein the Z coordinate value of the data point to be filtered is greater than the fitting base surface and less than a preset threshold value; the preset threshold value is determined according to the maximum Z coordinate value; Filtering the 3D point cloud data based on the data points to be filtered to obtain target 3D point cloud data; Filtering the regional image based on the target 3D point cloud data to obtain a first image; The step of filtering the 3D point cloud data based on the data points to be filtered includes: The Z coordinate value corresponding to the data point to be filtered in the 3D point cloud data is changed to 0; The area image includes 2D point cloud data, and the step of filtering the area image based on the target 3D point cloud data includes: The X coordinates and Y coordinates corresponding to the filtered data points in the target 3D point cloud data are matched with the 2D point cloud data to obtain the filtered data points in the 2D point cloud data, and the filtered data points in the 2D point cloud data are determined as data points in the background area.

2. The method according to claim 1, characterized in that The semantic segmentation model is trained in the following way: Acquire a sample image; wherein the sample image is pre-marked with a background area label, a solder area label, and a pin exposed area label; Dividing the sample images into data sets according to a preset ratio; wherein the data sets include: a training set, a validation set and a test set; Preprocessing the data set to obtain a target data set; wherein the target data set includes: a target training set, a target verification set, and a target test set; Iteratively training a pre-constructed semantic segmentation network based on the target training set and the target verification set to obtain a second semantic segmentation model; Based on the target test set, testing the second semantic segmentation model to obtain a test result; If the test result indicates that the second semantic segmentation model meets the preset model evaluation index, determining the second semantic segmentation model as the semantic segmentation model; If the test result indicates that the second semantic segmentation model does not meet the preset model evaluation index, continue to execute the step of acquiring the sample image until the second semantic segmentation model meets the preset model evaluation index to obtain the semantic segmentation model.

3. The method according to claim 2, characterized in that The step of iteratively training the pre-constructed semantic segmentation network based on the target training set and the target verification set to obtain a second semantic segmentation model includes: Iteratively training a pre-constructed semantic segmentation network based on the target training set to obtain a first semantic segmentation model; Verifying the first semantic segmentation model based on the target verification set to obtain a verification result; If the verification result indicates that the first semantic segmentation model does not meet the preset model evaluation indicators, the hyperparameters are adjusted and the step of iteratively training the pre-constructed semantic segmentation network based on the target training set to obtain the first semantic segmentation model is continued until the first semantic segmentation model meets the preset model evaluation indicators to obtain the second semantic segmentation model.

4. The method according to claim 2, characterized in that: The step of preprocessing the data set to obtain a target data set includes: Normalizing the data set using a preset processing method to obtain a normalized data set; The normalized data set is enhanced by using a variety of data enhancement methods to obtain a target data set; wherein the data enhancement methods include: horizontal flipping, random cropping, random brightness change, rotation, contrast adjustment and scaling.

5. The method according to claim 2, characterized in that: The semantic segmentation network is constructed in the following way: Based on the Hard Net network and deep separation convolution, a semantic segmentation network is constructed.

6. A device for detecting exposed pin defects of a component, characterized in that: The device comprises: An acquisition module, used for acquiring a regional image of a component to be detected; A filtering module, used for filtering the regional image based on a preset 3D detection algorithm to obtain a first image; An output module, used to input the first image into a pre-acquired reasoning model, so as to segment the first image into a background area, a solder area or a pin exposed area through the reasoning model, and different areas are represented by different pixel values, and output a label image corresponding to the first image; wherein the reasoning model is determined based on a deep learning reasoning tool and a pre-trained semantic segmentation model; A measuring module, for measuring the size and position of the exposed pin area according to preset industrial production requirements and a 2D detection algorithm to obtain a measurement result if the label image includes the exposed pin area; A judgment module, used for judging whether the component to be inspected has a pin exposure defect based on the measurement result and a preset index; The filtering module is also used for: Obtain 3D point cloud data of the component to be inspected; Filtering the regional image based on the 3D point cloud data and a least squares method to obtain a first image; The 3D point cloud data includes a plurality of data points, and the filtering module is further used for: Determine a target data point and a target coordinate value corresponding to the target data point based on the 3D point cloud data; wherein the target data point is a data point with a Z coordinate value of 0; Based on the target coordinate values, the target data points are fitted using the least squares method to obtain a fitting base surface; Selecting a maximum Z coordinate value from coordinate values ​​corresponding to a plurality of data points, and determining a data point to be filtered based on the maximum Z coordinate value and the fitting base surface, wherein the Z coordinate value of the data point to be filtered is greater than the fitting base surface and less than a preset threshold value; the preset threshold value is determined according to the maximum Z coordinate value; Filtering the 3D point cloud data based on the data points to be filtered to obtain target 3D point cloud data; Filtering the regional image based on the target 3D point cloud data to obtain a first image; The regional image includes 2D point cloud data, and the filtering module is further used for: The Z coordinate value corresponding to the data point to be filtered in the 3D point cloud data is changed to 0; The X coordinates and Y coordinates corresponding to the filtered data points in the target 3D point cloud data are matched with the 2D point cloud data to obtain the filtered data points in the 2D point cloud data, and the filtered data points in the 2D point cloud data are determined as data points in the background area.

7. An electronic device, characterized in that: It comprises a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the steps of the method for detecting exposed component pin defects as described in any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for detecting exposed component pin defects described in any one of claims 1 to 5 are executed.

Citation Information

Patent Citations

  • 3D point cloud welding spot defect detection method based on deep network

    CN112614105A

  • Weld defect real-time detection method and system based on 3D point cloud

    CN114354639A

  • Camera mold welding quality detection device and system thereof

    CN117092113A

  • Weld joint groove feature extraction method based on structured light and welding robot

    CN117853742A

  • Defect detection using one or more neural networks

    US20230125477A1