Electronic component installation quality detection method based on change detection
By combining PCA-DBSCAN change detection and Brute-Force matcher with the KNN method, the problems of slow detection speed and low classification accuracy in electronic component installation quality inspection are solved, and electronic component defects with complex shapes and large differences in size are realized. Accurate identification and classification provide more reliable detection results.
Patent Information
- Application Number
- CN202410734830.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-08-30
AI Technical Summary
The existing technology has the problems of slow detection speed, low accuracy of defect classification, and low versatility in the quality inspection of electronic component installation. Especially in the case of complex shapes and large differences in size, it is difficult to accurately identify and classify defects.
A change detection method based on PCA-DBSCAN is used to preprocess the image to remove environmental and background interference, perform pixel clustering and post-processing, and combine the Brute-Force matcher and KNN method to achieve classification of electronic component installation defects.
This method shows strong robustness in noise data processing, can accurately identify clusters of complex shapes, and reduces misjudgments. It is suitable for quality inspection of electronic components with irregular shapes and large differences in size, providing more accurate and reliable defect detection results.
Smart Images

Figure CN118570176A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electronic components, and in particular to a method for detecting the installation quality of electronic components based on change detection. Background Art
[0002] In the electronics industry, printed circuit boards (PCBs) are the main carrier for manufacturing circuits, and their technical applications are crucial to improving circuit performance. Early through-hole technology (THT) was an important milestone in the field of electronics manufacturing. This technology achieved circuit construction by passing the pins of components through the circuit board and soldering them. However, since THT requires that all components be designed with solder pins to pass through the circuit board, the size of the components is limited and cannot be designed to be too small, which also limits the size of the circuit board to a certain extent. With the advancement of science and technology, surface mount technology (SMT) came into being. This technology significantly optimizes the process flow of electronics manufacturing by directly mounting electrical components on the surface of printed circuit boards (PCBs). SMT achieves a close connection between components and circuit boards by applying solder paste to the solder feet of the parts. This technology shortens the length of the solder feet of the parts, allowing the size of the parts to be greatly reduced, thereby effectively reducing the volume of electronic parts, such as Figure 1 As shown. At present, SMT technology has widely replaced THT as the mainstream method of electronic parts assembly. This is mainly because SMT technology can significantly improve the automation level of electronic manufacturing, thereby reducing production costs and improving product quality. The application of SMT technology has not only promoted the development of the electronics industry, but also brought more advanced and efficient electronic products to consumers.
[0003] With the continuous advancement of surface mount technology (SMT), most parts can now be automatically positioned and soldered. However, with the rapid development of automation systems, the manufacturing, mounting and soldering technology of electronic components has also shown a trend of rapid changes. Although this technological innovation has brought about an increase in production efficiency, it has also led to a growing number and type of PCB defects. Therefore, it is particularly important to conduct rigorous and comprehensive quality control inspections during the production of PCB assemblies (PCBAs). The PCBA manufacturing process involves accurately soldering electronic components to PCBs. This process covers the application of solder paste, precise placement of components, curing of solder, and subsequent strict inspections. However, the existence of installation defects in the circuit board manufacturing process is still an issue that cannot be ignored. These defects may be caused by quality problems of raw materials and secondary production materials, or by factors such as improper use of machinery. Once any component on the circuit board is installed incorrectly, such as missing components, mismatched component models, skewed or flipped components, etc., it may cause circuit operation failure, and then cause serious defects in electronic products. Such defects not only affect the performance and reliability of the product, but also may cause huge economic losses to the manufacturer. Therefore, to ensure that the quality and performance of electronic products meet the established standards, every link from components to finished products must undergo strict and detailed testing procedures to ensure the overall quality and reliability of the product.
[0004] It is estimated that the failure rate of SMT is about 5%, of which solder joints and incorrect mounting problems account for the majority. Nowadays, some detection methods that meet industrial production requirements have been studied and developed according to the types of defects in assembled circuit boards. Initially, defects in assembled circuit boards were detected manually, and abnormalities were found by human inspectors to evaluate product quality. The success rate of this method is about 60% to 70%. Although it has the advantage of solving problems immediately, its effect fluctuates greatly due to factors such as human fatigue, lack of concentration, and experience. As printed circuit boards become more and more complex and multi-layered, manual visual inspection becomes very difficult and subjective. Subsequently, automatic optical inspection (AOI) technology and image processing technology came into being. The problem of both is that they require a long processing time. The AOI detection method is to obtain images through optical equipment to check the installation defects of devices on PCBs. Most AOI inspection machines use non-learning methods such as image comparison or rule checking to detect defects. However, for different inspection equipment, there will be problems with image resolution and color gradation differences. This will increase the difficulty of designing the inspection method. Compared with manual visual inspection, the success rate of automatic optical inspection and image processing technology has improved somewhat, but due to the slow detection speed and expensive optical instruments, its application scope in actual engineering has been stagnant.
[0005] In order to optimize the detection efficiency, defect detection technology based on artificial intelligence has been continuously developed, and people have proposed a technical solution based on machine learning methods: supervised learning (such as deep learning). This technology effectively reduces the processing time by reducing the complexity of the method, thereby improving the reliability of defect detection. However, due to the extremely rapid changes in the component architecture of assembled circuit boards, in most cases, it has become extremely difficult to find a sufficiently suitable and universal data set for it. Summary of the invention
[0006] In view of the defects in the prior art, an object of the present invention is to provide an electronic component installation quality detection method based on change detection.
[0007] According to one aspect of the present invention, there is provided a method for detecting the installation quality of electronic components based on change detection, comprising:
[0008] Preprocessing the input image to obtain a reference image and a test image that are mutually registered and free of environmental and background interference;
[0009] The preprocessed mutually registered reference image and the image to be tested are subjected to change detection based on PCA-DBSCAN to obtain pixel clustering;
[0010] Post-processing the pixel clusters to determine areas where changes have occurred;
[0011] A similarity calculation is performed based on the changed area, the changes are classified into different defects, and a final defect detection result is obtained.
[0012] Preferably, the pretreatment comprises:
[0013] Remove the influence of environmental differences through histogram matching;
[0014] Extract the outline of the assembled circuit board through depth limit cutting DEXTR and ignore the background interference;
[0015] The reference image and the image to be tested are registered by affine transformation.
[0016] Preferably, removing the influence of environmental differences by histogram matching includes:
[0017] From an image with a grayscale value of r to an image with a grayscale value of s after histogram equalization, the specific expression is:
[0018]
[0019] Where r and s represent the normalized original image grayscale and the image grayscale after histogram equalization, respectively; when r = s = 0, it represents black; when r = s = 1, it represents white; when r, s∈(0,1), it represents that the pixel grayscale changes between black and white; T(r) is the transformation function representing this calculation process, and any r in the interval [0,1] can generate a corresponding s through the transformation function T(r); p r (w) is the probability density of the random variable r;
[0020] There exists another image with grayscale value set z, whose image content is the same as the image with grayscale value set r; then the grayscale image corresponding to z is converted to the image corresponding to s through the function G(z), specifically:
[0021]
[0022] The grayscale mapping relationship between two images with the same content but different grayscale values is obtained, specifically:
[0023] z=G -1 [T(r)]=G -1 (s).
[0024] Preferably, the deep extreme cutting DEXTR is a deep learning tool comprising a convolutional neural network CNN and an additional channel of CNN input;
[0025] The four extreme points of the upper left, lower left, upper right and lower right of each object are taken as input, the additional channel obtains Gaussian information centered on each extreme point, and the convolutional neural network CNN generates coverage based on the Gaussian information centered on each extreme point, and converts the Gaussian information into segmentation of the object matching the extreme point.
[0026] Preferably, the registering the reference image and the image to be measured by affine transformation comprises:
[0027] Extract feature points and descriptors of the reference image and the image to be tested for matching;
[0028] Compute the transformation matrix using the matched point pairs;
[0029] Based on the transformation matrix, the image to be tested is transformed into the same orientation and position as the reference image.
[0030] Preferably, the preprocessed registered reference image and the image to be tested are subjected to change detection based on PCA-DBSCAN to determine the area where the change occurs, including:
[0031] Extract a set of features for each pixel to describe whether the pixel has changed from one image to another, and reduce the dimension of each set of features through PCA;
[0032] The spatial clustering method DBSCAN is used to cluster the features after dimension reduction into categories with varying degrees, and pixel clusters are obtained.
[0033] Preferably, DBSCAN is used to aggregate features of smaller dimensions into categories of varying degrees to obtain pixel clustering, including:
[0034] If the number of points in the ∈ neighborhood of a point exceeds MinPts, it is marked as a core point;
[0035] For each core point, connect all the points in its ∈ neighborhood to form a cluster;
[0036] Assign boundary points to the clusters of core points connected to them;
[0037] Points that are not classified into any cluster are marked as noise.
[0038] Preferably, the pixel clustering is post-processed to determine the changed area, including:
[0039] The mean square error metric is used to define each category:
[0040]
[0041] The categories are sorted according to the MSE value, and each category is given a corresponding color according to its value. The category with the smallest MSE value is blue, and the category with the largest MSE value is red;
[0042] After assigning colors to the categories, we get a heat map showing the intensity of the changes;
[0043] Discard the categories whose MSE values are lower than the threshold and generate a graph that only marks the suspected changes as new samples.
[0044] Preferably, similarity calculation is performed based on the changed area, the changes are classified into different defects, and the final defect detection result is obtained, including:
[0045] Use the Brute-Force matcher to find the most similar k neighbors by calculating the similarity between the new sample and each sample in the training set;
[0046] For classification problems, the KNN method is applied to classify samples according to their attribute values, counting the number of each category in the k neighbors and assigning new samples to the category with the largest number;
[0047] Use the similarity of neighbors in the KNN method as the final similarity of the sample;
[0048] Based on the final similarity, a defect classification is obtained.
[0049] Preferably, based on the final similarity, defect classification is obtained, including:
[0050] When the similarity threshold is between a and b, it is judged as skew, and when it is greater than b, it is polarity flipped;
[0051] When the threshold is less than a, there are two possibilities: missing parts and wrong parts. The color similarity module is then used to distinguish between missing parts and wrong parts.
[0052] Compared with the prior art, the embodiments of the present invention have at least one of the following beneficial effects:
[0053] The electronic component installation quality inspection method based on change detection in this embodiment, through PCA-DBSACAN change detection and defect classification, is suitable for situations with irregular shapes and large size differences, and can be used for quality inspection of electronic components of various complex shapes.
[0054] The electronic component installation quality detection method based on change detection proposed in this embodiment shows more powerful robustness in noise data processing. Specifically, the method adopts the DBSCAN method, which is a density-based clustering method that can accurately identify and filter noise points instead of arbitrarily assigning them to a certain cluster. In addition, the detection method does not need to specify the number of clusters in advance, avoiding the problem of misjudgment caused by improper setting of the number of clusters. The PCA-DBSCAN method can automatically discover the cluster structure according to the density characteristics of the data, so that the clustering results are closer to the actual distribution of the data. At the same time, the method can find clusters of any shape, and this feature makes it more adaptable when processing complex data structures and non-convex shape clusters. No matter how the cluster shape changes, the method can effectively capture and accurately identify. It is worth mentioning that the DBSCAN method is not affected by the selection of the initial cluster center, thereby ensuring the stability and reliability of the detection results. This feature makes the detection method more advantageous in practical applications and can provide users with more accurate and reliable electronic component installation quality detection results.
[0055] The electronic component installation quality inspection method based on change detection in the embodiment of the present invention adopts a Brute-Force matcher combined with a KNN method, and determines a threshold value according to experimental results to complete the classification of four defects: missing parts, wrong parts, skew, and reverse polarity.
[0056] The electronic component installation quality inspection method based on change detection in the embodiment of the present invention, on the one hand, does not need to update the labeled data set all the time, and on the other hand, can execute the learning program to extract the main features from the data. It is a relatively faster and more accurate universal assembly circuit board defect detection method. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0058] Figure 1 Schematic diagram of assembly process technology in the prior art, (a) represents THT technology, (b) represents SMT technology;
[0059] Figure 2 The following are examples of four defect types: (a) indicates missing parts, (b) indicates wrong parts, (c) indicates skew, and (d) indicates reverse.
[0060] Figure 3 It is a flow chart of an electronic component installation quality detection method based on change detection in one embodiment of the present invention;
[0061] Figure 4 It is a flowchart of image registration in a preferred embodiment of the present invention;
[0062] Figure 5 This is an experimental example diagram of a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0063] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several variations and improvements may be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.
[0064] Aiming at the problems that the installation defect detection of electronic components on circuit boards still has slow detection speed, low defect classification accuracy and weak versatility, the present invention proposes an electronic component installation quality detection method based on change detection, which is used to extract defect areas appearing in the installation process of printed circuit board components and complete the classification of defects, including: assembly category defects (missing parts, wrong parts), assembly posture defects (skew, reverse polarity), such as Figure 2 Now, a detailed description will be given in combination with a plurality of embodiments.
[0065] In one embodiment of the present invention, a method for detecting the installation quality of electronic components based on change detection is provided. Figure 3 As shown, the main process is:
[0066] S100, preprocessing the input image to obtain a reference image and an image to be tested that are registered and have the environment and background interference removed;
[0067] S200, performing change detection based on PCA-DBSCAN on the preprocessed registered reference image and the image to be tested, and performing pixel clustering;
[0068] S300, post-processing all pixel clusters, characterizing them using a heuristic approach, and determining the areas where changes have occurred;
[0069] S400, based on the changed area determined in S300, similarity calculation is performed, the changes are classified into different defects, and a final defect detection result is obtained.
[0070] The above embodiment uses change detection to perform quality inspection, which is suitable for situations where the shapes are irregular and the sizes vary greatly, and can be used for quality inspection of electronic components of various complex shapes.
[0071] In practical applications, the change detection in S200 may face challenges such as lighting changes, cluttered backgrounds, and a large number of different components on the circuit board; and preprocessing the image before performing change detection can effectively reduce the detection time. Therefore, in one embodiment of the present invention, the image is preprocessed first to ensure that the changed area can be detected quickly and accurately and the defect can be identified in various situations.
[0072] The preprocessing in this embodiment includes three steps, specifically:
[0073] S101, removing the influence of environmental differences by histogram normalization; wherein the environmental differences include illumination, imaging view, etc.
[0074] S102, extracting the outline of the assembled circuit board by depth limit cutting (DEXTR) and ignoring background interference;
[0075] S103, registering the reference image and the image to be measured by affine transformation.
[0076] Optical images are easily disturbed by fluctuations in lighting conditions, which can lead to large errors in the detection process. Under normal operating conditions, when the light source slowly weakens over time in a fixed capture system, the implementation of the precise histogram specification method can effectively optimize the impact of lighting differences. Therefore, in order to reduce the adverse effects of lighting differences on the accuracy of circuit board image recognition, the precise histogram specification technology is used for processing. In a preferred embodiment, S101 is implemented
[0077] For an image with a grayscale value of r to an image with a grayscale value of s after histogram equalization, the following formula is used:
[0078]
[0079] r and s represent the normalized original image grayscale and the image grayscale after histogram equalization respectively (because of normalization, the values of r and s are between 0 and 1). When r=s=0, it represents black; when r=s=1, it represents white; when r,s∈(0,1), it means that the pixel grayscale changes between black and white. T(r) is the transformation function representing this calculation process. For any r in the interval [0,1], a corresponding s can be generated through the transformation function T(r). p r (w) is the probability density of the random variable r. This formula is the transformation function T(r) we are looking for. It shows that when the transformation function T(r) is the cumulative distribution probability of the original image histogram, the purpose of histogram equalization can be achieved.
[0080] Now for this input image, there is another image with a grayscale value set z, whose image content is the same as the image with a grayscale value set r, but the grayscale values are different. Then the grayscale image corresponding to z can be converted to the image corresponding to s through the following function G(z):
[0081] You can get:
[0082] Therefore, the grayscale mapping relationship between two images with the same content but different grayscale values can be easily found.
[0083] z=G -1 [T(r)]=G -1 (s)
[0084] Further, after the histogram is normalized, in a preferred embodiment, S102 is implemented to perform deep extreme value cutting (DEXTR). Using DEXTR to extract the outline of the assembled circuit board in the preprocessing stage can ignore the complex background interference, and facilitate the extraction of specific components when comparing the partial defect positions of the assembled circuit board. Deep extreme cutting DEXTR is a deep learning tool, which includes a convolutional neural network CNN and an additional channel of CNN input; the four extreme points of each object, the upper left, lower left, upper right, and lower right, are used as inputs, and the additional channel obtains Gaussian information centered on each extreme point, and the convolutional neural network CNN generates coverage based on the Gaussian information centered on each extreme point, and converts the Gaussian information into a segmentation of the object matching the extreme point. In this way, the position information of the extreme point is converted into the form of a Gaussian function, and then the key information closely related to these feature points is extracted from the image. CNN is responsible for learning how to effectively convert these related Gaussian information into a segmented representation of the object matching the extreme point. The segmentation referred to here is to accurately segment the objects in the image and effectively distinguish different objects or regions.
[0085] In this network architecture, CNN accurately converts the extreme point information in the input image into segmented expressions of objects that correspond to these extreme points through the learning process, thereby achieving effective segmentation and identification of different target objects in the image. This mechanism enables the network to accurately locate and segment different objects in the image, thereby further supporting the precise execution of complex tasks such as target detection and image analysis.
[0086] The change detection of S200 requires comparing and analyzing the image to be tested with the reference image. Therefore, the two images need to be registered before change detection, so as to perform installation inspection on components at the same position and determine the defect type.
[0087] In a preferred embodiment, S103 is implemented to perform image registration, that is, the process of estimating the best transformation between two images, integrating the two images into a coordinate system to make them easier to compare. In this embodiment, a feature-based registration method is used, specifically:
[0088] S103.1, extracting feature points and descriptors of the reference image and the image to be tested for matching;
[0089] S103.2, calculating a transformation matrix using the matching point pairs determined in S103.1;
[0090] S103.3, using the transformation matrix calculated in S103.2, transform the target image into the same direction and position as the reference image.
[0091] Further, in a preferred embodiment, S103.1 is implemented by using a scale-invariant feature transform (SIFT) method, which has rotation, scale and brightness invariance. The flow chart is as follows: Figure 4 As shown, specifically:
[0092] Scale space extreme point detection: Gaussian difference pyramid is used to find extreme points in the image at different scales. These extreme points represent key features.
[0093] Accurate positioning of key points: For the detected extreme points, Gaussian pyramids are used around them to accurately locate the positions of the key points.
[0094] Direction assignment: Assign a main direction to each keypoint, making the keypoint rotation invariant.
[0095] Feature description: Based on the main direction of the key point and the gradient information of the surrounding area, a 128-dimensional feature vector is generated to describe the key point.
[0096] After completing the above steps, a set of vectors describing the key features of the image can be obtained.
[0097] Next, the vectors of these key features can be mapped to the positions in the other image by calculating the transformation matrix. This process usually uses the nearest neighbor search method to find matching feature points. Specifically, suppose there are two images A and B, where the feature vectors in A are a1, a2, ..., a n , the eigenvectors in B are b1,b2,...,b m For each eigenvector a in A i , we can calculate all the eigenvectors b in B j The Euclidean distance between them is calculated, and then the one with the smallest distance is selected as the matching feature point.
[0098] In a preferred embodiment, S103.2 is implemented: Once S103.1 finds a matching feature point pair (a i ,b j ), these point pairs can be used to calculate the corresponding transformation matrix. The RANSAC method can be used, which can estimate a suitable transformation matrix, such as an affine matrix or a perspective matrix, to minimize the error.
[0099] In a preferred embodiment, 103.3 is implemented: the conversion matrix calculated by S103.2 can correspond the feature points in image A to the positions in image B, thereby realizing the feature matching and feature transformation functions of the SIFT method.
[0100] Change detection is a technique used to detect changes in images or data. In general, change detection is usually faster than supervised learning detection methods because it usually does not require complex object recognition and positioning of the entire image. In circuit board installation defect detection, change detection can help identify anomalies or defects on the circuit board. The more basic PCA-Kmeans method is commonly used for change detection, but it is not suitable for situations where the defective part of the circuit board has components with irregular shapes and large size differences. In a preferred embodiment of the present invention, an improved PCA-DBSCAN machine learning method is used for the features of the two images. The specific process is as follows, which can be seen in Figure 5 Figure (a)(b)(c)(d):
[0101] S201, firstly extracting pixel features of the synthetic difference map by using the PCA method, and performing transformation detection on the difference map;
[0102] S202, using the spatial clustering method DBSCAN, the pixels are clustered into categories with change significance to determine which areas have changed.
[0103] In a preferred embodiment, S201 is implemented to extract a set of features for each pixel using a descriptor for two images of the same size, describing whether the pixel has changed from one image to another image, and each set of features (i.e., descriptor) is reduced to a smaller dimension by PCA.
[0104] Among them, PCA (Principal Component Analysis) is a statistical method used to reduce the dimension of data and discover the main features in the data. The working principle of PCA is as follows:
[0105] First, the raw data is preprocessed, usually including decentralization (subtracting the mean from the data) and standardization (dividing the data by the standard deviation) to ensure that the mean of the data is 0 and the variance is 1.
[0106] Next, calculate the covariance matrix of the data. The covariance matrix describes the relationship and degree of variation between different variables in the data.
[0107] Next, by performing eigenvalue decomposition on the covariance matrix, we can obtain the eigenvalues and corresponding eigenvectors. The eigenvalues represent the variance of the data in the direction of each eigenvector, while the eigenvectors represent the main variation pattern of the data in that direction.
[0108] Then, the eigenvalues are sorted by size, and the top k largest eigenvalues and their corresponding eigenvectors are selected. These selected eigenvectors are called principal components, which capture the most important change patterns in the data. By projecting the original data onto these principal components, the dimensionality of the data can be reduced and most of the information in the data can be retained.
[0109] Finally, if an approximate representation of the original data needs to be restored, the selected principal components can be used to project the reduced data back to the original space.
[0110] The principal component analysis (PCA) method can effectively transform high-dimensional data sets into low-dimensional representations, greatly simplifying the data processing and analysis process. PCA technology has been widely used in many fields such as data compression, feature extraction, cluster analysis, and image processing. It not only helps to reduce the complexity of data, but also helps to reveal the potential structure and relationship in the data, providing strong support for in-depth analysis and mining of data value.
[0111] In a preferred embodiment, S202 is implemented by clustering all these simplified features into categories of varying degrees using DBSCAN (Density-Based Spatial Clustering of Applications with Noise).
[0112] Since the PCA-DBSCAN method is performed on a small window around each pixel, this window-based learning approach can further eliminate the noise present in the input image.
[0113] Furthermore, the DBSCAN method is a density-based noise application spatial clustering method, which belongs to a density-based spatial clustering method in unsupervised learning. It divides the set of data points by defining a neighborhood radius ∈ and a minimum density threshold MinPts value. Specifically, the cluster formation process is:
[0114] Select core points: If the number of points in the ∈ neighborhood of a point exceeds MinPts, mark it as a core point.
[0115] Construct neighborhood chains: For each core point, connect all points in its ∈ neighborhood (including other core points) to form a cluster.
[0116] Attribution of border points: Assign border points to the clusters of core points connected to them.
[0117] Labeling Noise: Finally, points that are not classified into any cluster are labeled as noise.
[0118] It should be noted that in the DBSCAN method, a point refers to a sample or a data point in the data set. Specifically, a set of features extracted from each pixel can be regarded as a data point, and cluster analysis can be performed based on these data points.
[0119] When using DBSCAN for pixel clustering, boundary points do not necessarily refer to the boundary points of the extracted feature map, but to those points that are outside the ∈ neighborhood of the core point but connected to the core point. Specifically, in the DBSCAN method, for each core point, all points in its ∈ neighborhood are connected to form a cluster. Points that are outside the ∈ neighborhood of the core point but connected to the core point are considered boundary points. These boundary points cannot form a cluster alone, but are assigned to the cluster of a core point connected to them.
[0120] In view of the fact that the defective part of the circuit board may involve components of various types, irregular shapes, and significant size differences, and the update speed of the circuit board component design architecture is extremely rapid, the collected data sets often have problems such as noise interference, uneven density distribution, or unclear number of clusters. In most scenarios, it is particularly difficult to find a data set that is both suitable and universal. The PCA-DBSCAN method proposed in the aforementioned embodiment shows higher robustness when processing noisy data. It can effectively identify and filter noise points to avoid misassigning them to a certain cluster. In addition, the method does not need to pre-set the number of clusters, but automatically discovers the cluster structure based on the density distribution of the data. It can also effectively identify clusters of arbitrary shapes, so as to better adapt to complex and changeable data structures, especially those of non-convex shapes. At the same time, since this method is not affected by the initial parameters, it has higher stability.
[0121] In a preferred embodiment of the present invention, S300 is implemented for post-processing. In S200, all pixels are clustered, and each class is characterized according to a certain heuristic method in the post-processing stage to determine which classes represent "changes" in a more meaningful way; "more meaningful" here means those that represent real, significant or important changes in the image data, rather than random changes caused by noise or other irrelevant factors.
[0122] Therefore, in some specific embodiments, the mean square error MSE is selected for measurement. In the previous stage, all pixels are clustered into {C1, C2, ..., C n}, for each category C i is defined as follows:
[0123]
[0124] The categories are sorted according to the MSE value, and each category is given a corresponding color according to its value. For example, the category with the smallest MSE value is blue, and the category with the largest MSE value is red. After assigning colors to the categories, a heat map showing the intensity of the change is obtained. By discarding some categories with low MSE values, a map that only marks suspected changes is generated as a new sample.
[0125] In a preferred embodiment of the present invention, S400 is implemented to classify the determined “changes” into different defects based on similarity calculation to obtain a final defect detection result.
[0126] This embodiment adopts the method of combining Brute-Force matcher with KNN. Specifically, it includes the following process:
[0127] S401, using the Brute-Force matcher, finds the most similar k neighbors by calculating the similarity between the new sample and each sample in the training set.
[0128] S402, applying the KNN method to classify according to the attribute values (feature values, color similarity) of the samples, counting the data of each category in the K neighbors, and assigning the new samples to the category with the largest number.
[0129] S403, using the similarity of neighbors in the KNN method as the similarity of samples.
[0130] S404, based on the similarity in S403, determine the final classification, such as Figure 5 As shown in Figure (d).
[0131] In some specific embodiments, when the similarity threshold is between 0.1 and 0.6, it is determined to be skewed, and when it is greater than 0.6, it is determined to be polarity flipped. When the threshold is less than 0.1, there are two possibilities, namely, missing parts and wrong parts. The similarity of these two types of images is very low, but the color similarity of missing parts is not high, while the color similarity of wrong parts is high, so it is necessary to further use the color similarity module to distinguish between missing parts and wrong parts.
[0132] The existing change detection methods based on unsupervised learning can only extract the location and shape of the changes in the target area, but it is difficult to refine it to the specific meaning of the changes, and there is a problem of low defect classification accuracy. In the above embodiment, the Brute-Force matcher used is combined with the KNN method to achieve the classification of four defects: missing parts, wrong parts, skew, and reverse polarity. The Brute-Force matcher is used to calculate the similarity or distance between each sample and other samples. For each sample, the KNN method will find the K neighbors closest to the sample to be classified, and vote or weighted vote according to their categories to determine the category of the sample to be classified.
[0133] In addition, the above embodiment uses the Brute-Force matcher as a distance metric tool, which can directly calculate the Euclidean distance or other distance metrics between samples without the need for a complex model training process; the KNN method also does not require prior model training. For new defect types or categories, it only needs to be added to the training set. This makes the method more flexible when facing multi-category classification or dynamically updated classification problems.
[0134] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various modifications or variations within the scope of the claims, which does not affect the essence of the present invention. The above preferred features can be used in any combination without conflicting with each other.
Claims
1. A method for detecting the installation quality of electronic components based on change detection, characterized in that: include: Preprocessing the input image to obtain a reference image and a test image that are mutually registered and free of environmental and background interference; The preprocessed mutually registered reference image and the image to be tested are subjected to change detection based on PCA-DBSCAN to obtain pixel clustering; Post-processing the pixel clusters to determine areas where changes have occurred; A similarity calculation is performed based on the changed area, the changes are classified into different defects, and a final defect detection result is obtained.
2. The electronic component installation quality detection method based on change detection according to claim 1 is characterized in that: The preprocessing comprises: Remove the influence of environmental differences through histogram matching; Extract the outline of the assembled circuit board through depth limit cutting DEXTR and ignore the background interference; The reference image and the image to be tested are registered by affine transformation.
3. The electronic component installation quality detection method based on change detection according to claim 2 is characterized in that: The removing the influence of environmental differences by histogram matching includes: From an image with a grayscale value of r to an image with a grayscale value of s after histogram equalization, the specific expression is: Where r and s represent the normalized original image grayscale and the image grayscale after histogram equalization, respectively; when r = s = 0, it represents black; when r = s = 1, it represents white; when r, s∈(0,1), it represents that the pixel grayscale changes between black and white; T(r) is the transformation function representing this calculation process, and any r in the interval [0,1] can generate a corresponding s through the transformation function T(r); p r (w) is the probability density of the random variable r; There is another image with grayscale value set z, whose image content is the same as the image with grayscale value set r; the grayscale image corresponding to z is converted to the image corresponding to s through the function G(z), specifically: The grayscale mapping relationship between two images with the same content but different grayscale values is obtained, specifically: z=G -1 [T(r)]=G -1 (s)。 4. The electronic component installation quality detection method based on change detection according to claim 2 is characterized in that: The Deep Extreme Cutting (DEXTR) is a deep learning tool that includes a convolutional neural network (CNN) and an additional channel for CNN input; The four extreme points of the upper left, lower left, upper right and lower right of each object are taken as input, the additional channel obtains Gaussian information centered on each extreme point, and the convolutional neural network CNN generates coverage based on the Gaussian information centered on each extreme point, and converts the Gaussian information into segmentation of the object matching the extreme point.
5. The electronic component installation quality detection method based on change detection according to claim 2 is characterized in that: The registering of the reference image and the image to be measured by affine transformation comprises: Extract feature points of the reference image and the image to be tested and their corresponding descriptions for matching; Compute the transformation matrix using the matched point pairs; Based on the transformation matrix, the image to be tested is transformed into the same orientation and position as the reference image.
6. The electronic component installation quality detection method based on change detection according to claim 1 is characterized in that: The preprocessed registered reference image and the image to be tested are subjected to change detection based on PCA-DBSCAN to determine the changed areas, including: Extract a set of features for each pixel to describe whether the pixel has changed from one image to another, and reduce the dimension of each set of features through principal component analysis (PCA). The spatial clustering method DBSCAN is used to cluster the features after dimension reduction into categories with varying degrees, and pixel clusters are obtained.
7. The electronic component installation quality detection method based on change detection according to claim 6 is characterized in that: Use DBSCAN to aggregate the reduced-dimensional features into categories of varying degrees, and obtain pixel clusters, including: Determine whether the number of points in the ∈ neighborhood of a point exceeds MinPts. If so, mark it as a core point; For each core point, connect all the points in its ∈ neighborhood to form a cluster; Assign boundary points to the clusters of core points connected to them; Points that are not classified into any cluster are marked as noise.
8. The electronic component installation quality detection method based on change detection according to claim 6 is characterized in that: The pixels are clustered and post-processed to determine the changed area, including: The mean square error metric is used to define each category: C i represents the i-th cluster formed, I1(i,j) represents a pixel in the cluster, and I2(i,j) c represents another pixel in the cluster; The categories are sorted according to the MSE value, and each category is given a corresponding color according to its value. The category with the smallest MSE value is blue, and the category with the largest MSE value is red; After assigning colors to the categories, we get a heat map showing the intensity of the changes; Discard the categories whose MSE values are lower than the threshold and generate a graph that only marks the suspected changes as new samples.
9. The electronic component installation quality detection method based on change detection according to claim 1, characterized in that: Based on the changed areas, similarity calculation is performed to classify the changes into different defects and obtain the final defect detection results, including: Use the Brute-Force matcher to find the most similar k neighbors by calculating the similarity between the new sample and each sample in the training set; For classification problems, the KNN method is applied to classify samples according to their attribute values, counting the number of each category in the k neighbors and assigning new samples to the category with the largest number; Use the similarity of neighbors in the KNN method as the final similarity of the sample; Based on the final similarity, a defect classification is obtained.
10. The electronic component installation quality detection method based on change detection according to claim 9, characterized in that: Based on the final similarity, a defect classification is obtained, including: When the similarity threshold is between a and b, it is judged as skew, and when it is greater than b, it is polarity flipped; When the threshold is less than a, there are two possibilities: missing parts and wrong parts. The color similarity module is then used to distinguish between missing parts and wrong parts.
Citation Information
Patent Citations
Double-sided visual inspection and recognition device
CN109342457A
Characteristic point extraction and matching method and system based on color image, and medium
CN113011498A
Plug-in visual detection and identification method, readable storage medium and equipment
CN113344931A
Battery cell consistency evaluation method based on charging fragment data and unsupervised algorithm
CN115372828A
Cited By
Strain clamp detection information management method based on X-ray image recognition
CN118781129A
Circuit board visual quality inspection system and method based on AOI
CN120369744A
Method and apparatus for printed circuit board image positioning and computer device
WO2026178789A1
