A computer PCB mainboard production quality detection method

By combining color and edge gradient feature information with the improved LBP algorithm, the problem of low detection accuracy of the existing LBP algorithm is solved, and higher precision PCB quality inspection is achieved.

CN115272350BActive Publication Date: 2026-07-14JIANGSU BAO YI COMM TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JIANGSU BAO YI COMM TECH CO LTD
Filing Date
2022-09-30
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing PCB quality inspection methods based on the LBP algorithm have low detection accuracy and cannot meet current detection accuracy requirements.

Method used

An improved LBP algorithm is adopted. The average difference between the gray values ​​of each pixel on the edge of the window and the gray value of the center pixel is used as a threshold. Combined with the color deviation information within the window, the texture and color feature information of the defect area is obtained. Combined with the edge gradient feature information, the trained neural network is used to classify defects.

Benefits of technology

It improves the accuracy of defect area classification and judgment, reduces the amount of calculation, enhances the characterization effect of defect features, and improves detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115272350B_ABST
    Figure CN115272350B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of data processing, in particular to a computer PCB mainboard production quality detection method. The method carries out data acquisition on a PCB mainboard surface image recognized by an image recognition electronic device, acquires the data of the PCB mainboard surface, and then carries out processing and analysis on the acquired data. The method focuses on improving the data processing method after data acquisition, changing the threshold value of the existing LBP algorithm, adding color feature information therein to complete defect category judgment, and additionally acquiring edge gradient feature information of a defect area. The method provided by the application solves the problem of insufficient accuracy of the existing LBP algorithm when the LBP algorithm is used for quality detection of a PCB, and solves the technical problem that the LBP algorithm cannot meet the accuracy requirement when the LBP algorithm is used for quality detection of a PCB.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and more specifically to a method for quality inspection of computer PCB motherboards. Background Technology

[0002] PCBs are the most basic components in electronic products, and their main function is to insulate or connect components. As the number of PCB layers increases and the degree of integration improves, the probability and variety of quality defects during the manufacturing process also increase significantly, making PCB quality inspection increasingly important.

[0003] Traditional methods for detecting PCB defects mainly rely on visual inspection and electrical contact testing by inspectors. These methods are susceptible to human subjectivity, resulting in high costs, low efficiency, and low accuracy. Therefore, existing technologies have proposed PCB quality inspection methods based on image feature recognition, including methods that extract image features using the LBP algorithm to complete PCB quality inspection. However, in practical applications, it has been found that the accuracy of using existing LBP algorithms for PCB quality inspection is not high. Current methods that use LBP algorithms to obtain feature information from PCB graphics for PCB quality inspection cannot meet current accuracy requirements. Summary of the Invention

[0004] To address the issue that the current LBP algorithm cannot meet the accuracy requirements for PCB quality inspection, this invention provides a method for quality inspection of computer PCB motherboards. The specific technical solution adopted is as follows:

[0005] The present invention provides a method for quality inspection in the production of computer PCB motherboards, comprising the following steps:

[0006] Acquire images of the PCB motherboard surface, determine whether there are defects on the PCB motherboard surface based on the images, and identify the defect area if defects are present.

[0007] Using any pixel in the defect area of ​​the grayscale image on the PCB motherboard surface as the center pixel, a window of a predetermined size is defined. The mean of the differences between the grayscale values ​​of each pixel at the edge of the window and the grayscale value of the center pixel is calculated. This mean is then used as a threshold to calculate the LBP value of the center pixel.

[0008]

[0009]

[0010]

[0011] in, Let be the grayscale value of the i-th pixel on the edge of the window. Here, M is the grayscale value of the center pixel within the window, M is the threshold, and P is the total number of pixels at the window edges. It is a threshold function;

[0012] The PCB motherboard surface image is transformed using Lab space. Based on the LBP value of the center pixel of the window and the color information, feature values ​​that simultaneously represent the texture and color features of the window are obtained.

[0013]

[0014]

[0015]

[0016] Wherein, LBPC is a feature value that simultaneously represents the window's texture and color features. The LBP value of the center pixel of the window. This represents the color value of each pixel within the window. The color value of the center pixel of the window. L represents the average deviation of the color values ​​of each pixel at the edge of the window from the color value of the center pixel. L represents the brightness dimension, and a and b represent the color contrast dimension.

[0017] The feature values ​​corresponding to all pixels within the defect area are the feature information of the defect area. The feature information is input into the trained neural network to determine and classify the defects, thereby obtaining the PCB motherboard production quality evaluation value and completing the PCB motherboard production quality inspection.

[0018] The beneficial effects of this invention are as follows:

[0019] This invention, when calculating the LBP value of the center pixel, no longer directly uses the grayscale value of the center pixel as a threshold and performs local binarization of other pixels within the window by judging whether their grayscale values ​​are greater than the threshold. Instead, it uses the average difference between the grayscale value of the center pixel and the grayscale values ​​of other pixels within the window as the threshold, and performs local binarization of other pixels within the window by judging whether the difference between their grayscale values ​​and the center pixel's grayscale value is greater than the threshold. This eliminates pixels within the window with small grayscale differences compared to the center pixel, and highlights pixels with large grayscale differences compared to the center pixel, improving the window texture representation effect and reducing the computational load. At the same time, color deviation information within the window, i.e., color information, is incorporated into the LBP algorithm, which more effectively represents defect features and further improves the accuracy of defect region classification.

[0020] Furthermore, the feature information also includes edge gradient feature information of the defect region, and the method for determining the edge gradient feature information of the defect region is as follows:

[0021] Edge detection is performed on the grayscale image of the PCB motherboard surface to determine the edge of the defect area. A pixel Q is randomly selected on the edge of the defect area, and a neighborhood of a set size is determined for pixel Q. All pixels belonging to the defect edge within the neighborhood are removed, resulting in two new neighborhoods: the defect neighborhood and the normal neighborhood.

[0022] Take any pixel W in the defect neighborhood and calculate the difference C between it and a pixel Q on the edge of the defect region:

[0023]

[0024] in, Let W be the grayscale value of pixel W in the defect neighborhood. Let Q be the grayscale value of the pixel at the edge of the defect region. as well as These represent the brightness information of pixel W in the defect neighborhood and pixel Q on the edge of the defect region in Lab space, respectively. as well as These represent the color components, from green to red, of pixel W in the defect neighborhood and pixel Q on the edge of the defect region in Lab space. as well as These represent the color components of pixel W in the defect neighborhood and pixel Q on the edge of the defect region in Lab space, ranging from blue to yellow.

[0025] By identifying the pixel E in the defect neighborhood that has the largest difference C with pixel Q, the first feature vector of pixel Q can be obtained. :

[0026]

[0027] in, Let E be the coordinates of pixel E. Let Q be the coordinates of pixel Q;

[0028] Correspondingly, the second feature vector of pixel Q can be obtained in the normal neighborhood. That is, each pixel Q on the edge of the defect region corresponds to two feature vectors, and the feature vectors of all pixels on the edge of the defect region are the edge gradient feature information of the defect region.

[0029] Furthermore, the specific method for determining whether there are defects on the PCB motherboard surface based on the PCB motherboard surface image, and for determining the defect area when defects exist, is as follows:

[0030] The PCB motherboard surface image is converted to grayscale to obtain a grayscale image of the PCB motherboard surface. The difference between the grayscale image of the PCB motherboard surface and the standard grayscale image of the PCB motherboard surface without surface defects is obtained to obtain a difference image. The difference image is then binarized, with the difference area marked as 1 and the remaining area marked as 0, to obtain a binary image.

[0031] If the grayscale value of all pixels in the binary image is 0, then there is no defect on the PCB motherboard surface; otherwise, there is a defect on the PCB motherboard surface. Multiply the binary image with the PCB motherboard surface image to mark the location of the defect on the PCB motherboard surface image.

[0032] Furthermore, the PCB motherboard manufacturing quality evaluation value is:

[0033]

[0034] Where Z represents the PCB motherboard manufacturing quality evaluation value. The weights corresponding to different types of defects on the PCB motherboard surface. Let be the area of ​​the i-th defect region on the PCB motherboard surface, and n be the total number of defects on the PCB motherboard surface. Attached Figure Description

[0035] Figure 1 This is a flowchart of the computer PCB motherboard manufacturing quality inspection method of the present invention;

[0036] Figure 2 This is a schematic diagram of the improved circular LBP algorithm of the present invention. Detailed Implementation

[0037] The following detailed description of a computer PCB motherboard manufacturing quality inspection method of the present invention, in conjunction with the accompanying drawings and embodiments, provides a clearer picture.

[0038] Method Implementation Examples:

[0039] An embodiment of the computer PCB motherboard manufacturing quality inspection method of the present invention, the overall process of which is as follows: Figure 1 As shown, the specific process is as follows:

[0040] 1. Use image acquisition equipment to obtain images of the PCB motherboard surface and determine the defect areas on the PCB motherboard surface.

[0041] Relevant electronic equipment, such as an industrial camera, is used to acquire surface images of the PCB motherboard. A weighted average method is then used to convert the acquired surface images to grayscale, resulting in a grayscale image of the PCB motherboard surface. Of course, other grayscale processing methods from the prior art can also be used in other embodiments.

[0042] The grayscale image of the PCB motherboard surface is filtered and denoised, then subtracted from a standard grayscale image of a PCB motherboard surface without surface defects to obtain a difference image. This difference image is then binarized, with the difference region marked as 1 and the remaining regions marked as 0, resulting in a binary image. If there are no defects on the PCB motherboard surface, all pixels in the binary image should have a grayscale value of 0; otherwise, regions with a grayscale value of 1 will exist. Multiplying the binary image by the acquired PCB motherboard surface image allows for the marking of defect locations on the acquired PCB motherboard surface image.

[0043] This completes the detection of defects on the PCB motherboard and identifies the location of the defective areas on the surface.

[0044] 2. The improved LBP algorithm is used to extract the texture and color features of the defect area.

[0045] The existing LBP algorithm selects a window in the defect area of ​​the grayscale image of the PCB motherboard, uses the grayscale value of the center pixel in the window as a threshold, and judges whether the grayscale value of each pixel in the surrounding neighborhood of the center pixel exceeds the neighborhood. If it exceeds, it is marked as 1, otherwise it is marked as 0. In this way, the LBP value of the window is obtained, and the obtained LBP value reflects the texture information of the window.

[0046] The existing LBP algorithm only considers the relationship between the center pixel and its several neighboring pixels within the window. It does not take into account the role of the center pixel, the overall difference gradient between the gray values ​​of the center pixel and its several neighboring pixels, or the color information of the center pixel. This results in the loss of some important local structural features, which affects the classification and recognition of defects.

[0047] To address this, this embodiment proposes an improved LBP algorithm that considers the grayscale gradient of the center pixel and its neighborhood, as well as color information.

[0048] like Figure 2 As shown, this embodiment uses a circular LBP algorithm as an example to describe the improved LBP algorithm proposed in this example. Of course, other LBP algorithms of different shapes, such as rectangular LBP algorithms, can also be used in other embodiments. A window of radius R is defined as the selected defect area in the grayscale image of the PCB motherboard surface. P pixels are evenly distributed on the circumference of the window. The neighboring pixels on the circumference of the window can be determined by trilinear interpolation. Parameters P and R are set according to the detection accuracy and minimum defect size requirements. In this embodiment, P=8 and R=1.

[0049] When using this improved LBP algorithm for encoding, firstly, within the window, the grayscale value of the center pixel is subtracted from the grayscale values ​​of each of its neighboring pixels, and the absolute value is taken. Then, the mean of all absolute values ​​is calculated to obtain the threshold M.

[0050]

[0051] in, Let be the grayscale value of the i-th pixel on the circumference of the window. This represents the grayscale value of the center pixel within the window.

[0052] Then, by comparing the difference between the gray values ​​of each pixel in the neighborhood and the gray value of the center pixel with the threshold M, encoding is performed to obtain the following threshold function:

[0053]

[0054] Then the LBP value of the center pixel of the corresponding window is:

[0055]

[0056] The LBP value of the center pixel of the window is the LBP value of the window, which represents the texture feature information of the window area.

[0057] Since the color separation of each layer of PCB is relatively high, and the color deviation of each type of defect is also relatively high, it is appropriate to establish a color model and add it to the texture analysis to improve the accuracy of classification.

[0058] After performing Lab space transformation on the PCB motherboard surface image, feature values ​​that can simultaneously represent the texture and color features of the window region are obtained based on the LBP value and color information of the center pixel of the window:

[0059]

[0060]

[0061]

[0062] in The LBP value of the window. This represents the color value of each pixel within the window. The color value of the center pixel of the window. This is the average value of the color values ​​of each pixel in the neighborhood of the center pixel within the window, relative to the color value of the center pixel. The larger this average value is, the greater the color deviation within the window and the more obvious the defect features. L represents the brightness dimension, and a and b represent the color contrast dimension.

[0063] By calculating the feature values ​​LBPC of each window in the defect area, the texture and color feature information of the entire defect area can be obtained.

[0064] 3. Obtain edge gradient feature information of the defect area.

[0065] On the grayscale image of the PCB motherboard surface, the edge of the defect area is detected and determined using the Canny operator. Assuming a pixel on the edge is designated as point Q, its grayscale value is... Determine which other pixels are in the 5*5 neighborhood of pixel Q and their corresponding gray values. Remove all pixels that belong to the edge of the defect area in the 5*5 neighborhood. Calculate the gray gradient of pixel Q by combining the remaining pixels with pixel Q.

[0066] All the pixels on the defect edges within the neighborhood divide the 5x5 neighborhood of point Q into two regions. It is undeniable that one region belongs to the normal area of ​​the PCB surface, and the other to the defect area. Therefore, one region is the normal neighborhood, and the other is the defect neighborhood. Assuming that after removing all edge pixels, N non-edge pixels remain in the neighborhood, with A pixels in the defect neighborhood and B pixels in the normal neighborhood, then A + B = N.

[0067] The angle of the maximum gradient direction is obtained for both the defective neighborhood and the normal neighborhood, and is used as the angle of the gradient feature vector of the edge pixel Q point.

[0068] The acquisition method is as follows:

[0069] Take any pixel W in the defect neighborhood and calculate the difference C between it and a pixel Q on the edge of the defect region:

[0070]

[0071] in, Let W be the grayscale value of pixel W in the defect neighborhood. Let Q be the grayscale value of the pixel at the edge of the defect region. as well as These represent the brightness information of pixel W in the defect neighborhood and pixel Q on the edge of the defect region in Lab space, respectively. as well as These represent the color components, from green to red, of pixel W in the defect neighborhood and pixel Q on the edge of the defect region in Lab space. as well as These represent the color components of pixel W in the defect neighborhood and pixel Q on the edge of the defect region in Lab space, ranging from blue to yellow.

[0072] Each pixel in the defect neighborhood has a color difference value C relative to the edge pixel Q. The pixel with the largest C value, let's call it point E, is selected, and its coordinates are recorded. , Then the first feature vector of pixel Q can be obtained. :

[0073]

[0074] Similarly, the second feature vector of pixel Q can be obtained in the normal neighborhood region. .but , That is, the feature vector of pixel Q on the defect edge. Assuming there are G edge pixels, then the edge pixels correspond to 2G feature vectors. These 2G feature vectors can characterize the gradient information of the edge of the defect area on the PCB motherboard surface.

[0075] The purpose of calculating the gradient information of the defect region edge in this embodiment is to obtain new feature information that can be used to determine the defect region on the basis of texture feature information and color feature information, so as to further improve the accuracy of defect region identification. It is easy to understand that in other embodiments, the gradient information of the defect region edge may not be obtained, but only the texture feature information and color feature information of the defect region may be obtained through the improved LBP algorithm.

[0076] 4. Input the feature information into the trained neural network to identify and classify defects, and obtain the PCB motherboard production quality inspection results.

[0077] The above steps have extracted the feature information of the defective region. However, the amount of feature information obtained is too large and there is some redundant information, which will have a certain impact on the classification results. Therefore, this embodiment filters the feature information obtained above and performs dimensionality reduction processing on the feature information through PCA principal component analysis to reduce the amount of calculation and improve the classification accuracy.

[0078] This invention classifies defect regions using a neural network. The neural network shown is a pre-trained network, and its training samples are surface images of PCB motherboards with different defect types, sizes, and numbers corresponding to different feature information. Since neural network training is existing technology, its specific training process will not be described in detail here. The network structure is as follows: a semantic segmentation network. The aforementioned feature information is input into the pre-trained neural network. The input is the feature information of each defect region, and the output is a classification probability vector for each defect region. The category corresponding to the maximum probability value is the type of defect. The network loss function uses the cross-entropy loss function.

[0079] This allows us to determine the types, number, and size of all defects on the PCB motherboard, thus obtaining the PCB motherboard's production quality evaluation value.

[0080]

[0081] In the formula, The weights corresponding to different types of defects on the PCB motherboard surface. Let be the area of ​​the i-th defect region on the PCB motherboard surface, and n be the total number of defects on the PCB motherboard surface.

[0082] Thus, the classification of PCB motherboard surface defects was completed using neural networks.

[0083] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A method for quality inspection in the production of computer PCB motherboards, characterized in that, Includes the following steps: Acquire images of the PCB motherboard surface, determine whether there are defects on the PCB motherboard surface based on the images, and identify the defect area if defects are present. Using any pixel in the defect area of ​​the grayscale image on the PCB motherboard surface as the center pixel, a window of a predetermined size is defined. The mean of the differences between the grayscale values ​​of each pixel at the edge of the window and the grayscale value of the center pixel is calculated. This mean is then used as a threshold to calculate the LBP value of the center pixel. ; ; ; in, Let be the grayscale value of the i-th pixel on the edge of the window. Here, M is the grayscale value of the center pixel within the window, M is the threshold, and P is the total number of pixels at the window edges. It is a threshold function; The window is circular; the window selected in the defect area of ​​the grayscale image on the PCB motherboard surface is a circular area with a radius of R. P pixels are evenly distributed on the circumference of the window. The neighboring pixels on the circumference of the window can be determined by trilinear interpolation. The parameters P and R are set according to the detection accuracy and minimum defect size requirements. The PCB motherboard surface image is transformed using Lab space. Based on the LBP value of the center pixel of the window and the color information, feature values ​​that simultaneously represent the texture and color features of the window are obtained. ; ; ; Wherein, LBPC is a feature value that simultaneously represents the window's texture and color features. The LBP value of the center pixel of the window. This represents the color value of each pixel within the window. The color value of the center pixel of the window. L represents the average deviation of the color values ​​of each pixel at the edge of the window from the color value of the center pixel. L represents the brightness dimension, and a and b represent the color contrast dimension. The feature values ​​corresponding to all pixels within the defect area are the feature information of the defect area. The feature information is input into the trained neural network to determine and classify the defects, thereby obtaining the PCB motherboard production quality evaluation value and completing the PCB motherboard production quality inspection. The feature information also includes edge gradient feature information of the defect region, and the method for determining the edge gradient feature information of the defect region is as follows: Edge detection is performed on the grayscale image of the PCB motherboard surface to determine the edge of the defect area. A pixel Q is randomly selected on the edge of the defect area, and a neighborhood of a set size is determined for pixel Q. All pixels belonging to the defect edge within the neighborhood are removed, resulting in two new neighborhoods: the defect neighborhood and the normal neighborhood. Take any pixel W in the defect neighborhood and calculate the difference C between it and a pixel Q on the edge of the defect region: ; in, Let W be the grayscale value of pixel W in the defect neighborhood. Let Q be the grayscale value of the pixel at the edge of the defect region. as well as These represent the brightness information of pixel W in the defect neighborhood and pixel Q on the edge of the defect region in Lab space, respectively. as well as These represent the color components, from green to red, of pixel W in the defect neighborhood and pixel Q on the edge of the defect region in Lab space. as well as These represent the color components of pixel W in the defect neighborhood and pixel Q on the edge of the defect region in Lab space, ranging from blue to yellow. By identifying the pixel E in the defect neighborhood that has the largest difference C with pixel Q, the first feature vector of pixel Q can be obtained. : ; in, Let E be the coordinates of pixel E. Let Q be the coordinates of pixel Q; Correspondingly, the second feature vector of pixel Q can be obtained in the normal neighborhood. That is, each pixel Q on the edge of the defect region corresponds to two feature vectors, and the feature vectors of all pixels on the edge of the defect region are the edge gradient feature information of the defect region. The PCB motherboard manufacturing quality evaluation value is: ; Where Z represents the PCB motherboard manufacturing quality evaluation value. The weights corresponding to different types of defects on the PCB motherboard surface. Let be the area of ​​the i-th defect region on the PCB motherboard surface, and n be the total number of defects on the PCB motherboard surface.

2. The method for quality inspection of computer PCB motherboard production according to claim 1, characterized in that, The specific method for determining whether there are defects on the surface of the PCB motherboard based on the PCB motherboard surface image, and for determining the defect area when defects exist, is as follows: The PCB motherboard surface image is converted to grayscale to obtain a grayscale image of the PCB motherboard surface. The difference between the grayscale image of the PCB motherboard surface and the standard grayscale image of the PCB motherboard surface without surface defects is obtained to obtain a difference image. The difference image is then binarized, with the difference area marked as 1 and the remaining area marked as 0, to obtain a binary image. If the grayscale value of all pixels in the binary image is 0, then there is no defect on the PCB motherboard surface; otherwise, there is a defect on the PCB motherboard surface. Multiply the binary image with the PCB motherboard surface image to mark the location of the defect on the PCB motherboard surface image.