A flexible circuit board manufacturing defect detection system and method based on artificial intelligence
Through a flexible circuit board manufacturing defect detection system based on artificial intelligence, using technologies such as image processing and local Markov algorithms, the problems of slow speed and low accuracy of traditional detection methods are solved, and efficient and accurate manufacturing defect detection is achieved.
Patent Information
- Application Number
- CN202411207842.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2044-08-30
AI Technical Summary
Traditional flexible circuit board detection methods are slow and have low accuracy, making it difficult to intelligently identify complex defects. The prior art only realizes the identification of appearance defects, but fails to detect manufacturing defects.
Using a flexible circuit board manufacturing defect detection system based on artificial intelligence, a flexible circuit board image is obtained, a detection matrix is generated and median filtering, grayscale transformation and sharpening are performed. Combined with local Markov algorithms and pyramid detection matrix, defect areas are located and marked, and finally defect detection is achieved through a comprehensive judgment through the FDNet neural network.
It improves the accuracy and efficiency of defect detection of flexible circuit board manufacturing, and can quickly identify complex defects. Compared with other neural networks, it takes a short time and has a high detection accuracy.
Smart Images

Figure CN119180792B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of defect detection, and in particular to a flexible circuit board manufacturing defect detection system and method based on artificial intelligence. Background Art
[0002] Chinese patent CN109239102A discloses a method for detecting appearance defects of flexible circuit boards based on CNN (convolutional neural network), which specifically includes: obtaining an FPC (flexible circuit board) image, preprocessing the FPC image to obtain a region to be detected, the region to be detected is a region of interest ROI, and generating an ROI (region of interest) image; then recording the coordinate position of defective pixels in the ROI image, recording the ROI image with defective pixels marked as a defective image, and recording the ROI image without defective pixels marked as a non-defective image; sampling the defective image, setting a sampler to traverse the defective image in sequence, obtaining a defective image sub-image, counting the number of defective pixels on the defective image sub-image, and dividing the defective image sub-image into defective samples and non-defective samples; using defective samples and non-defective samples to train the CNN neural network, and adjusting parameters to optimize the CNN neural network to obtain a trained CNN neural network; then using the trained CNN neural network to test the FPC image, obtaining a comprehensive determination result of the defective area, and finally judging whether the flexible circuit board has defects based on the comprehensive determination result of the defective area and the threshold value. This invention only relies on image processing to identify appearance defects of flexible circuit boards, and does not realize manufacturing defect detection.
[0003] Traditional flexible circuit board inspection methods have disadvantages such as slow speed and low accuracy. In addition, there are many types of manufacturing defects in flexible circuit boards. Errors are prone to occur in the detection of small and complex defects in flexible circuit boards, and they cannot intelligently identify circuit board manufacturing defects. Summary of the invention
[0004] In response to the problems in the related art, the present invention provides a flexible circuit board manufacturing defect detection system and method based on artificial intelligence to overcome the above-mentioned technical problems existing in the existing related technology.
[0005] In order to solve the above technical problems, the present invention is achieved through the following technical solutions:
[0006] The present invention is a method for detecting defects in manufacturing flexible circuit boards based on artificial intelligence, comprising the following steps:
[0007] S1, acquiring a flexible circuit board image, generating a flexible circuit board detection matrix, and performing improved median filtering, grayscale transformation and sharpening processing on the flexible circuit board detection matrix to obtain a processed flexible circuit board detection matrix;
[0008] S2, dividing the processed flexible circuit board detection matrix, obtaining a sub-flexible circuit board detection matrix, and then selecting candidate pixels, and then based on the local Markov algorithm model, establishing a k-order local Markov model in the eight-neighborhood of the candidate pixels, and determining the suspected defective pixels by the state probability of the k-order local Markov model to obtain a key detection pixel matrix;
[0009] S3, constructing a pyramid detection matrix according to the key detection pixel matrix, comparing the key detection pixel matrix and the pyramid detection matrix based on the similarity principle, locating the abnormal area of the key detection pixel matrix by mapping and marking, and obtaining a defect marking matrix;
[0010] S4. Train the FDNet neural network to obtain the FDNet network model, convert the defect annotation matrix into a final defect annotation image, use the FDNet network model for classification, and realize flexible circuit board manufacturing defect detection through comprehensive judgment.
[0011] The invention first generates a flexible circuit board detection matrix based on the flexible circuit board image, and first performs an improved median filtering process on the flexible circuit board detection matrix. By selecting a threshold, noise and real pixels can be accurately distinguished. Then, grayscale transformation is performed to change the grayscale value of the pixel point to enhance the contrast. Finally, the bicubic difference method is used for sharpening to enhance edge information and improve the accuracy of defect recognition. Secondly, based on the local Markov model, a histogram is constructed in the sub-flexible circuit board detection matrix to select candidate pixels, and an eight-neighborhood of pixels is established. A k-order local Markov model is constructed by calculating the probability of the neighborhood state to identify suspected defective pixels. The establishment of a local Markov model can effectively reduce the recognition error rate. Then, a pyramid detection matrix is constructed based on the suspected defective pixels. Based on the similarity principle, the key detection pixel matrix and the pyramid detection matrix are compared. The abnormal area is located by mapping and annotated to obtain a defect annotation matrix. The FDNet network is trained to obtain the FDNet network model, and the final defect annotation image is generated according to the defect annotation matrix. Finally, a comprehensive judgment is made to determine whether the flexible circuit board is defective, and the flexible circuit board manufacturing defect detection is completed. Compared with other neural network detections, the FDNet network takes less time and has higher detection accuracy.
[0012] Preferably, the S1 comprises the following steps:
[0013] S11, obtaining a flexible circuit board image, selecting i×j data detection points on the flexible circuit board image for sampling, and quantizing the data detection points to generate a flexible circuit board detection matrix A as follows:
[0014]
[0015] Among them, aij Represents the i-th horizontal and j-th vertical pixel on the flexible circuit board image;
[0016] A filter window of size b×b is selected in the flexible circuit board detection matrix, where b is an odd number, the filter window is located in the upper left corner of the flexible circuit board detection matrix, and the upper left corner data element in the filter window coincides with the upper left corner data element in the flexible circuit board detection matrix; the mean and variance of the pixel values of the pixel points in the filter window are calculated, and are recorded as the pixel value mean, respectively. And the pixel value variance Setting β1 and β2 to adjust the parameters, the upper limit of the noise threshold Noise Threshold Lower Limit When the pixel value of the pixel point in the filtering window is between the upper limit of the noise threshold and the lower limit of the noise threshold, the pixel point in the filtering window is not processed, otherwise the pixel point in the filtering window is subjected to median filtering to obtain a filtering flexible circuit board detection matrix, and the specific steps are as follows:
[0017] S111, record the filter window located at the upper left corner of the flexible circuit board detection matrix as the first filter window, arrange the grayscale values of the pixels in the first filter window in descending order, select the middle grayscale value, record it as the first grayscale value, and use the first grayscale value to replace the grayscale value of the central pixel of the first filter window to complete the first filtering process;
[0018] S112, moving the first filtering window to the right by one pixel to obtain a second filtering window, arranging the grayscale values of the pixels in the second filtering window in descending order, selecting an intermediate grayscale value, recording it as a second grayscale value, and using the second grayscale value to replace the grayscale value of the central pixel of the second filtering window to complete the second filtering process; repeating S111 and S112 until the grayscale values of all pixels in the flexible circuit board detection matrix are replaced, and the median filtering process is completed;
[0019] S12, giving the gray value mapping relationship of the pixel points in the filtering flexible circuit board detection matrix, recorded as the grayscale transformation mapping relationship, setting the grayscale value range of the pixel points in the filtering flexible circuit board detection matrix to [b1, b2], after the grayscale value of the pixel points in the filtering flexible circuit board detection matrix is processed by the grayscale transformation mapping relationship, the grayscale value range of the pixel points is [b3, b4], and the grayscale transformation mapping relationship calculation formula is as follows:
[0020]
[0021] in, represents the gray value of the i-th horizontal and j-th vertical pixel in the filter flexible circuit board detection matrix, B(i,j) represents the gray value of the i-th horizontal and j-th vertical pixel in the filter flexible circuit board detection matrix after grayscale transformation, α represents the grayscale transformation slope and
[0022] A grayscale transformation threshold ω is set. When the grayscale transformation slope is greater than 1, the grayscale value range of the pixel points in the filter flexible circuit board detection matrix is greater than ω, and the exposure is increased; when the grayscale transformation slope is greater than or equal to 0 and less than or equal to 1, the grayscale value range of the pixel points in the filter flexible circuit board detection matrix is equal to ω, and the grayscale value does not change; when the grayscale transformation slope is less than 0, the grayscale value range of the pixel points in the filter flexible circuit board detection matrix is less than ω, and the exposure is reduced, the grayscale transformation is completed, and the grayscale transformation flexible circuit board detection matrix is obtained;
[0023] S13, select a neighborhood with a size of c×c in the grayscale transformation flexible circuit board detection matrix, detect the neighborhood edge direction, calculate the gradient values of the neighborhood in the 45-degree direction, 135-degree direction, vertical direction and horizontal direction, and use the gradient values in the 45-degree direction and 135-degree direction as the first orthogonal direction gradient value c1, and use the gradient values in the vertical direction and horizontal direction as the second orthogonal direction gradient value c2; set the gradient threshold to ξ, when When , the pixel points in the neighborhood are in the 45-degree direction or the 135-degree direction, that is, in the strong edge area. When , the pixel points in the neighborhood are in the vertical and horizontal directions, that is, in the strong edge area; otherwise, the pixel points in the neighborhood are in the weak edge area;
[0024] If a pixel in the neighborhood is in a strong edge area, the bicubic difference result is used to estimate the pixel value of the pixel in the neighborhood, which is recorded as the pixel value of the first pixel, and the pixel value of the first pixel is used to replace the pixel value of the missing pixel in the strong edge area; if a pixel in the neighborhood is in a weak edge area, the orthogonal bicubic difference result is used to estimate the pixel value of the pixel in the neighborhood in the 45-degree direction or 135-degree direction, which is recorded as the pixel value of the second pixel, and the orthogonal bicubic difference result is used to estimate the pixel value of the pixel in the neighborhood in the vertical and horizontal directions, which is recorded as the pixel value of the third pixel; the pixel value of the second pixel is used to replace the pixel value of the missing pixel in the weak edge area in the 45-degree direction or 135-degree direction, and the pixel value of the third pixel is used to replace the pixel value of the missing pixel in the weak edge area in the vertical and horizontal directions; the neighborhood is continuously moved until all pixels in the grayscale transformation flexible circuit board detection matrix are detected, and a processed flexible circuit board detection matrix is obtained.
[0025] The invention generates a flexible circuit board detection matrix based on the flexible circuit board image, first performs an improved median filtering process on the flexible circuit board detection matrix, and uses the grayscale value of the middle pixel to replace the grayscale value of the center pixel of the window after judging the threshold, which can effectively remove noise, and then performs grayscale transformation to change the grayscale value of the pixel to enhance the recognition effect, uses the bicubic difference method for sharpening, and enhances the edge information by inserting the lost pixel values to improve the accuracy of defect recognition.
[0026] Preferably, S2 comprises the following steps:
[0027] S21, selecting c' sub-flexible circuit board detection matrices of size c"×c"' from the processed flexible circuit board detection matrix, extracting grayscale histogram features in the sub-flexible circuit board detection matrix, setting d1 to represent the grayscale of the sub-flexible circuit board detection matrix, The number of pixels with grayscale value i1 in the sub-flexible circuit board detection matrix is represented by the grayscale histogram eigenvalue of the sub-flexible circuit board detection matrix. The calculation formula is as follows,
[0028]
[0029] According to the grayscale histogram eigenvalue of the sub-flexible circuit board detection matrix, the sub-flexible circuit board detection matrix is extracted, the average value of the pixel values of the pixels in the sub-flexible circuit board detection matrix is calculated, and a first candidate pixel point is selected in the sub-flexible circuit board detection matrix, and the pixel value of the first candidate pixel point is less than the difference between the grayscale histogram eigenvalue and the average value of the pixel values of the pixels in the sub-flexible circuit board detection matrix; a new sub-flexible circuit board detection matrix is selected from the other c′-1 sub-flexible circuit board detection matrices, the average value of the pixel values of the pixels in the new sub-flexible circuit board detection matrix is calculated, and then a second candidate pixel point is selected; S21 is repeated for the other c′-2 sub-flexible circuit board detection matrices to obtain a set of candidate pixels;
[0030] S22, the gray value of the candidate pixel in the candidate pixel set is recorded as d′, the average value of the pixel values corresponding to the candidate pixel in the candidate pixel set is recorded as d″, and the gray histogram feature is The calculation formula of the initial probability B″ of the candidate pixel point in the candidate pixel point set is as follows:
[0031]
[0032] Select any candidate pixel point in the candidate pixel point set and record it as the first candidate pixel point. Record the eight neighboring pixels around the first candidate pixel point as the eight neighborhood of the pixel point. Establish a first-order local Markov model in the eight neighborhood of the pixel point, set the state to B″′, and the gray value difference between the first candidate pixel point and the pixel points in the eight neighborhood of the pixel point is Where i2 represents the number of pixels in the eight-neighborhood of the pixel point and i2 = 1, 2, ..., 8, the grayscale of the eight-neighborhood of the pixel point is d1, then the probability calculation formula of the pixel point in the eight-neighborhood of the pixel point in state B″′ is as follows:
[0033]
[0034] in, represents the probability that the i2th pixel in the eight-neighborhood of the pixel is in state B″′;
[0035] The first-order local Markov model is described as Then calculate the probability of the second-order local Markov model in state B″′ to obtain the second-order local Markov model, and obtain the k-order local Markov model and the probability of the k-order local Markov model in state B″′ in turn; use the probability of the k-order local Markov model in state B″′ to judge the pixel points in the eight-neighborhood of the pixel point, when the probability of the pixel point in the eight-neighborhood of the pixel point in state B″′ is less than 0.5, the pixel point in the eight-neighborhood of the pixel point is recorded as a suspected defective pixel point, when the probability of the pixel point in the eight-neighborhood of the pixel point in state B″′ is greater than or equal to 0.5, the pixel point in the eight-neighborhood of the pixel point is not a suspected defective pixel point; all candidate pixels in the candidate pixel set repeat S22, and the suspected defective pixels are composed of a key detection pixel matrix.
[0036] The invention constructs a histogram based on a local Markov model to select candidate pixels, uses the candidate points to establish an eight-neighborhood of the pixel points, and constructs a k-order local Markov model by calculating the probability of the neighborhood state within the eight-neighborhood of the pixel points to identify suspected defective pixels. Establishing a local Markov model can effectively reduce the recognition error rate.
[0037] Preferably, S3 comprises the following steps:
[0038] S31, constructing a pyramid detection matrix according to the key detection pixel matrix, setting the number of pyramid layers to e, recording the 0th layer pyramid detection matrix as the initial pixel matrix, the 1st layer pyramid detection matrix is obtained by smoothing the 0th layer pyramid detection matrix, and the size of the 1st layer pyramid detection matrix is half of the 0th layer pyramid detection matrix, the 2nd layer pyramid detection matrix is obtained by smoothing the 1st layer pyramid detection matrix, and the size of the 2nd layer pyramid detection matrix is half of the 1st layer pyramid detection matrix, and pyramid detection matrices are obtained in sequence;
[0039] Select the second layer pyramid detection matrix, construct a Hessian matrix according to the second layer pyramid detection matrix, obtain the eigenvalues e1 and e2 of the Hessian matrix, and the first variable of the Hessian matrix The second variable of the Hessian matrix A response function is established according to the first variable and the second variable of the Hessian matrix, in which the pixel points in the second-layer pyramid detection matrix are smoothed according to the degree of change of the response function parameters to obtain a processed second-layer pyramid detection matrix;
[0040] S32, set a detection window of size e3×e4 to slide in the processed second-layer pyramid detection matrix with a step size δ, the detection window starts at the upper left corner of the processed second-layer pyramid detection matrix, calculate the average gray value of the pixels in the detection window and the gray value standard deviation of the pixels, and keep moving the detection window until the average gray value of all pixels in the processed second-layer pyramid detection matrix, the gray value standard deviation of the pixels and the gray value covariance of the pixels are obtained, and the similarity index is obtained. The calculation formula is as follows:
[0041]
[0042]
[0043] Among them, D′(x,y) represents the brightness contrast function, D″(x,y) represents the contrast contrast function, D″′(x,y) represents the structure contrast function, and g x Indicates the average gray value of the pixel in the horizontal direction, g y Indicates the average gray value of the pixel in the vertical direction, h x Indicates the standard deviation of the gray value of the pixel in the horizontal direction, h y Indicates the standard deviation of the gray value of the pixel in the vertical direction. represents the covariance of the grayscale values of the pixels, k1, k2, k3, α1, α2 and α3 represent constants, and D(x, y) represents the similarity index;
[0044] S33, if the pixel value of the pixel point in the second-layer pyramid detection matrix after the processing is greater than or equal to the similarity index, the pixel point in the second-layer pyramid detection matrix after the processing is normal, otherwise, the pixel point in the second-layer pyramid detection matrix after the processing is abnormal, the detection window is slid to the pixel point with the abnormality, the pixel point with the abnormality is mapped to the initial pixel point matrix, and the coordinates of the pixel point with the abnormality in the initial pixel point matrix are obtained to form a first abnormal area;
[0045] Slide the detection window in the first-layer pyramid detection matrix, the detection window starts at the upper left corner of the first-layer pyramid detection matrix, scale the pixels in the detection window, and keep moving the detection window until all the pixels in the first-layer pyramid detection matrix are scaled, so as to obtain a scaled first-layer pyramid detection matrix, and the scaled scaled first-layer pyramid detection matrix has a size of g1×g2; perform discrete cosine transform on the scaled first-layer pyramid detection matrix to obtain a processed first-layer pyramid detection matrix, and select a pixel with a size of g1×g2 from the processed first-layer pyramid detection matrix. a detection submatrix, calculating an average value of pixel values of the detection submatrix, and when the pixel value of the pixel in the first-layer pyramid detection matrix after processing is greater than the average value of the pixel value of the detection submatrix, setting the corresponding pixel in the first-layer pyramid detection matrix after processing to 1, otherwise setting the corresponding pixel in the first-layer pyramid detection matrix after processing to 0, and calculating a hash value of the detection submatrix;
[0046] S34. Calculate the Hamming distance between the hash values of the initial pixel matrix and the detection submatrix, set the distance threshold to ψ, when the Hamming distance between the hash values of the initial pixel matrix and the detection submatrix is less than or equal to ψ, the pixels in the detection submatrix are normal, otherwise the pixels in the detection submatrix are abnormal, map the detection submatrix to the initial pixel matrix, obtain the coordinates of the abnormal pixels in the initial pixel matrix, and form a second abnormal area; mark the first abnormal area and the second abnormal area in the key detection pixel matrix to obtain a defect marking matrix.
[0047] The invention constructs a pyramid detection matrix through suspected defective pixels, obtains each layer of the pyramid detection matrix in turn by continuous smoothing processing, and then compares the key detection pixel matrix and the pyramid detection matrix based on the similarity principle. After mapping the anomaly, the abnormal area is located and marked, thereby reducing the amount of calculation. Each layer of the pyramid detection matrix is detected in parallel to improve the detection efficiency.
[0048] Preferably, S4 comprises the following steps:
[0049] S41, obtaining a new flexible circuit board image, marking defects on the new flexible circuit board image, obtaining a new defect labeling matrix, generating a defective flexible circuit board image and a non-defective flexible circuit board image from the new defect labeling matrix, dividing the defective flexible circuit board image and the non-defective flexible circuit board image into a defect training set and a defect test set, inputting the defect training set into the FDNet (fault detection) network for training, and continuously adjusting parameters until the FDNet network converges to obtain a trained FDNet network; then inputting the defect test set into the trained FDNet network, setting the defect detection accuracy threshold to ζ, and obtaining the FDNet network model when the accuracy of the trained FDNet network output result is less than ζ, otherwise repeating S41 until the accuracy of the trained FDNet network output result is less than ζ;
[0050] S42, converting the defect annotation matrix into a final defect annotation image, inputting the final defect annotation image into the FDNet network model, and outputting the probability of the final defect annotation image being classified as defective and the probability of the final defect annotation image being classified as non-defective; setting the defect probability of the final defect annotation image to h1, and the non-defect probability of the final defect annotation image to h2, the comprehensive judgment formula F is as follows:
[0051]
[0052] The comprehensive judgment threshold is set to σ. When the result of the comprehensive judgment formula is less than σ, the final defect annotation image has no defects and the flexible circuit board manufacturing has no defects. Otherwise, the final defect annotation image has defects and the flexible circuit board manufacturing has defects, and the flexible circuit board manufacturing defect detection is completed.
[0053] This invention trains the FDNet network, generates a final defect annotation image based on the defect annotation matrix, inputs the final defect annotation image into the FDNet network model, and determines whether the flexible circuit board has defects through comprehensive judgment, thereby completing the flexible circuit board manufacturing defect detection. Compared with other neural network detections, the use of the FDNet network takes less time and has a higher detection accuracy.
[0054] The present invention also discloses a system for a flexible circuit board manufacturing defect detection method based on artificial intelligence, which specifically includes: a flexible circuit board detection matrix preprocessing module, a suspected defect pixel location module, a flexible circuit board detection matrix defect annotation module and a network model defect detection module;
[0055] The flexible circuit board detection matrix preprocessing module is used to perform improved median filtering, grayscale transformation and sharpening processing on the flexible circuit board detection matrix;
[0056] The suspected defect pixel location module is used to determine and locate the suspected defect pixel based on the local Markov model;
[0057] The flexible circuit board detection matrix defect annotation module is used to construct a pyramid detection matrix, locate abnormal areas through mapping and mark defects;
[0058] The network model defect detection module is used to train the FDNet neural network and then use the FDNet network model to make judgments to achieve flexible circuit board manufacturing defect detection.
[0059] The present invention has the following beneficial effects:
[0060] 1. The invention generates a flexible circuit board detection matrix based on the flexible circuit board image. After performing improved median filtering, grayscale transformation and sharpening processing on the flexible circuit board detection matrix, noise can be effectively removed, recognition effect and edge information can be enhanced, and the accuracy of defect recognition can be improved.
[0061] 2. The invention constructs a histogram based on a local Markov model to select candidate pixels, uses the candidate points to establish an eight-neighborhood of the pixel points, and constructs a k-order local Markov model by calculating the probability of the neighborhood state within the eight-neighborhood of the pixel points to identify suspected defective pixels. Establishing a local Markov model can effectively reduce the recognition error rate.
[0062] 3. The invention constructs a pyramid detection matrix through suspected defective pixels, compares the key detection pixel matrix and the pyramid detection matrix based on the similarity principle, maps the anomaly and locates the abnormal area and marks it, which reduces the amount of calculation and improves the detection efficiency;
[0063] 4. The invention obtains the FDNet network model by training the FDNet network, generates a final defect annotation image according to the defect annotation matrix, inputs the final defect annotation image into the FDNet network model, and determines whether the flexible circuit board has defects through comprehensive judgment, thereby completing the flexible circuit board manufacturing defect detection. Compared with other neural network detections, the use of the FDNet network takes less time and has a higher detection accuracy.
[0064] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the technical solutions of the embodiments of the invention, the drawings required for describing the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the invention. For ordinary technicians in this field, they can also obtain drawings based on these drawings without paying creative work.
[0066] Figure 1A schematic diagram of the process of flexible circuit board manufacturing defect detection by an artificial intelligence-based flexible circuit board manufacturing defect detection system provided by the present invention. DETAILED DESCRIPTION
[0067] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not 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.
[0068] In the description of the present invention, it is necessary to understand that the terms "opening", "upper", "lower", "top", "middle", "inside" and the like indicating orientation or positional relationship are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the components or elements referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore cannot be understood as limiting the invention.
[0069] This embodiment discloses a flexible circuit board manufacturing defect detection method based on artificial intelligence, which specifically includes the following contents:
[0070] S1, acquiring a flexible circuit board image, generating a flexible circuit board detection matrix, and performing improved median filtering, grayscale transformation and sharpening processing on the flexible circuit board detection matrix to obtain a processed flexible circuit board detection matrix;
[0071] The S1 comprises the following steps:
[0072] S11, obtaining a flexible circuit board image, selecting i×j data detection points on the flexible circuit board image for sampling, and quantizing the data detection points to generate a flexible circuit board detection matrix A as follows:
[0073]
[0074] Among them, a ij Represents the i-th horizontal and j-th vertical pixel on the flexible circuit board image;
[0075] A filter window of size b×b is selected in the flexible circuit board detection matrix, where b is an odd number, the filter window is located in the upper left corner of the flexible circuit board detection matrix, and the upper left corner data element in the filter window coincides with the upper left corner data element in the flexible circuit board detection matrix; the mean and variance of the pixel values of the pixel points in the filter window are calculated, and are recorded as the pixel value mean, respectively. And the pixel value variance Setting β1 and β2 to adjust the parameters, the upper limit of the noise threshold Noise Threshold Lower Limit When the pixel value of the pixel point in the filtering window is between the upper limit of the noise threshold and the lower limit of the noise threshold, the pixel point in the filtering window is not processed, otherwise the pixel point in the filtering window is subjected to median filtering to obtain a filtering flexible circuit board detection matrix, and the specific steps are as follows:
[0076] S111, record the filter window located at the upper left corner of the flexible circuit board detection matrix as the first filter window, arrange the grayscale values of the pixels in the first filter window in descending order, select the middle grayscale value, record it as the first grayscale value, and use the first grayscale value to replace the grayscale value of the central pixel of the first filter window to complete the first filtering process;
[0077] S112, moving the first filtering window to the right by one pixel to obtain a second filtering window, arranging the grayscale values of the pixels in the second filtering window in descending order, selecting an intermediate grayscale value, recording it as a second grayscale value, and using the second grayscale value to replace the grayscale value of the central pixel of the second filtering window to complete the second filtering process; repeating S111 and S112 until the grayscale values of all pixels in the flexible circuit board detection matrix are replaced, and the median filtering process is completed;
[0078] S12, giving the gray value mapping relationship of the pixel points in the filtering flexible circuit board detection matrix, recorded as the grayscale transformation mapping relationship, setting the grayscale value range of the pixel points in the filtering flexible circuit board detection matrix to [b1, b2], after the grayscale value of the pixel points in the filtering flexible circuit board detection matrix is processed by the grayscale transformation mapping relationship, the grayscale value range of the pixel points is [b3, b4], and the grayscale transformation mapping relationship calculation formula is as follows:
[0079]
[0080] in, represents the gray value of the i-th horizontal and j-th vertical pixel in the filter flexible circuit board detection matrix, B(i,j) represents the gray value of the i-th horizontal and j-th vertical pixel in the filter flexible circuit board detection matrix after grayscale transformation, α represents the grayscale transformation slope and
[0081] A grayscale transformation threshold ω is set. When the grayscale transformation slope is greater than 1, the grayscale value range of the pixel points in the filter flexible circuit board detection matrix is greater than ω, and the exposure is increased; when the grayscale transformation slope is greater than or equal to 0 and less than or equal to 1, the grayscale value range of the pixel points in the filter flexible circuit board detection matrix is equal to ω, and the grayscale value does not change; when the grayscale transformation slope is less than 0, the grayscale value range of the pixel points in the filter flexible circuit board detection matrix is less than ω, and the exposure is reduced, the grayscale transformation is completed, and the grayscale transformation flexible circuit board detection matrix is obtained;
[0082] S13, select a neighborhood with a size of c×c in the grayscale transformation flexible circuit board detection matrix, detect the neighborhood edge direction, calculate the gradient values of the neighborhood in the 45-degree direction, 135-degree direction, vertical direction and horizontal direction, and use the gradient values in the 45-degree direction and 135-degree direction as the first orthogonal direction gradient value c1, and use the gradient values in the vertical direction and horizontal direction as the second orthogonal direction gradient value c2; set the gradient threshold to ξ, when When , the pixel points in the neighborhood are in the 45-degree direction or the 135-degree direction, that is, in the strong edge area. When , the pixel points in the neighborhood are in the vertical and horizontal directions, that is, in the strong edge area; otherwise, the pixel points in the neighborhood are in the weak edge area;
[0083] If a pixel in the neighborhood is in a strong edge area, the bicubic difference result is used to estimate the pixel value of the pixel in the neighborhood, which is recorded as the pixel value of the first pixel, and the pixel value of the first pixel is used to replace the pixel value of the missing pixel in the strong edge area; if a pixel in the neighborhood is in a weak edge area, the orthogonal bicubic difference result is used to estimate the pixel value of the pixel in the neighborhood in the 45-degree direction or 135-degree direction, which is recorded as the pixel value of the second pixel, and the orthogonal bicubic difference result is used to estimate the pixel value of the pixel in the neighborhood in the vertical and horizontal directions, which is recorded as the pixel value of the third pixel; the pixel value of the second pixel is used to replace the pixel value of the missing pixel in the weak edge area in the 45-degree direction or 135-degree direction, and the pixel value of the third pixel is used to replace the pixel value of the missing pixel in the weak edge area in the vertical and horizontal directions; the neighborhood is continuously moved until all pixels in the grayscale transformation flexible circuit board detection matrix are detected, and a processed flexible circuit board detection matrix is obtained;
[0084] S2, dividing the processed flexible circuit board detection matrix, obtaining a sub-flexible circuit board detection matrix, and then selecting candidate pixels, and then based on the local Markov algorithm model, establishing a k-order local Markov model in the eight-neighborhood of the candidate pixels, and determining the suspected defective pixels by the state probability of the k-order local Markov model to obtain a key detection pixel matrix;
[0085] The S2 comprises the following steps:
[0086] S21, selecting c' sub-flexible circuit board detection matrices of size c"×c"' from the processed flexible circuit board detection matrix, extracting grayscale histogram features in the sub-flexible circuit board detection matrix, setting d1 to represent the grayscale of the sub-flexible circuit board detection matrix, The number of pixels with grayscale value i1 in the sub-flexible circuit board detection matrix is represented by the grayscale histogram eigenvalue of the sub-flexible circuit board detection matrix. The calculation formula is as follows,
[0087]
[0088] According to the grayscale histogram eigenvalue of the sub-flexible circuit board detection matrix, the sub-flexible circuit board detection matrix is extracted, the average value of the pixel values of the pixels in the sub-flexible circuit board detection matrix is calculated, and a first candidate pixel point is selected in the sub-flexible circuit board detection matrix, and the pixel value of the first candidate pixel point is less than the difference between the grayscale histogram eigenvalue and the average value of the pixel values of the pixels in the sub-flexible circuit board detection matrix; a new sub-flexible circuit board detection matrix is selected from the other c′-1 sub-flexible circuit board detection matrices, the average value of the pixel values of the pixels in the new sub-flexible circuit board detection matrix is calculated, and then a second candidate pixel point is selected; S21 is repeated for the other c′-2 sub-flexible circuit board detection matrices to obtain a set of candidate pixels;
[0089] S22, the gray value of the candidate pixel in the candidate pixel set is recorded as d′, the average value of the pixel values corresponding to the candidate pixel in the candidate pixel set is recorded as d″, and the gray histogram feature is The calculation formula of the initial probability B″ of the candidate pixel point in the candidate pixel point set is as follows:
[0090]
[0091] Select any candidate pixel point in the candidate pixel point set and record it as the first candidate pixel point. Record the eight neighboring pixels around the first candidate pixel point as the eight neighborhood of the pixel point. Establish a first-order local Markov model in the eight neighborhood of the pixel point, set the state to B″′, and the gray value difference between the first candidate pixel point and the pixel points in the eight neighborhood of the pixel point is Where i2 represents the number of pixels in the eight-neighborhood of the pixel point and i2 = 1, 2, ..., 8, the grayscale of the eight-neighborhood of the pixel point is d1, then the probability calculation formula of the pixel point in the eight-neighborhood of the pixel point in state B″′ is as follows:
[0092]
[0093] in, represents the probability that the i2th pixel in the eight-neighborhood of the pixel is in state B″′;
[0094] The first-order local Markov model is described as Then calculate the probability of the second-order local Markov model in state B″′ to obtain the second-order local Markov model, and obtain the k-order local Markov model and the probability of the k-order local Markov model in state B″′ in turn; use the probability of the k-order local Markov model in state B″′ to judge the pixel points in the eight-neighborhood of the pixel point, when the probability of the pixel point in the eight-neighborhood of the pixel point in state B″′ is less than 0.5, the pixel point in the eight-neighborhood of the pixel point is recorded as a suspected defective pixel point, when the probability of the pixel point in the eight-neighborhood of the pixel point in state B″′ is greater than or equal to 0.5, the pixel point in the eight-neighborhood of the pixel point is not a suspected defective pixel point; repeat S22 for all candidate pixels in the candidate pixel point set, and form the suspected defective pixels into a key detection pixel point matrix;
[0095] S3, constructing a pyramid detection matrix according to the key detection pixel matrix, comparing the key detection pixel matrix and the pyramid detection matrix based on the similarity principle, locating the abnormal area of the key detection pixel matrix by mapping and marking, and obtaining a defect marking matrix;
[0096] The S3 comprises the following steps:
[0097] S31, constructing a pyramid detection matrix according to the key detection pixel matrix, setting the number of pyramid layers to e, recording the 0th layer pyramid detection matrix as the initial pixel matrix, the 1st layer pyramid detection matrix is obtained by smoothing the 0th layer pyramid detection matrix, and the size of the 1st layer pyramid detection matrix is half of the 0th layer pyramid detection matrix, the 2nd layer pyramid detection matrix is obtained by smoothing the 1st layer pyramid detection matrix, and the size of the 2nd layer pyramid detection matrix is half of the 1st layer pyramid detection matrix, and pyramid detection matrices are obtained in sequence;
[0098] Select the second layer pyramid detection matrix, construct a Hessian matrix according to the second layer pyramid detection matrix, obtain the eigenvalues e1 and e2 of the Hessian matrix, and the first variable of the Hessian matrix The second variable of the Hessian matrix A response function is established according to the first variable and the second variable of the Hessian matrix, in which the pixel points in the second-layer pyramid detection matrix are smoothed according to the degree of change of the response function parameters to obtain a processed second-layer pyramid detection matrix;
[0099] S32, set a detection window of size e3×e4 to slide in the processed second-layer pyramid detection matrix with a step size δ, the detection window starts at the upper left corner of the processed second-layer pyramid detection matrix, calculate the average gray value of the pixels in the detection window and the gray value standard deviation of the pixels, and keep moving the detection window until the average gray value of all pixels in the processed second-layer pyramid detection matrix, the gray value standard deviation of the pixels and the gray value covariance of the pixels are obtained, and the similarity index is obtained. The calculation formula is as follows:
[0100]
[0101]
[0102] Among them, D′(x,y) represents the brightness contrast function, D″(x,y) represents the contrast contrast function, D″′(x,y) represents the structure contrast function, and g x Indicates the average gray value of the pixel in the horizontal direction, g y Indicates the average gray value of the pixel in the vertical direction, h x Indicates the standard deviation of the gray value of the pixel in the horizontal direction, h y Indicates the standard deviation of the gray value of the pixel in the vertical direction. represents the covariance of the grayscale values of the pixels, k1, k2, k3, α1, α2 and α3 represent constants, and D(x, y) represents the similarity index;
[0103] S33, if the pixel value of the pixel point in the second-layer pyramid detection matrix after the processing is greater than or equal to the similarity index, the pixel point in the second-layer pyramid detection matrix after the processing is normal, otherwise, the pixel point in the second-layer pyramid detection matrix after the processing is abnormal, the detection window is slid to the pixel point with the abnormality, the pixel point with the abnormality is mapped to the initial pixel point matrix, and the coordinates of the pixel point with the abnormality in the initial pixel point matrix are obtained to form a first abnormal area;
[0104] Slide the detection window in the first-layer pyramid detection matrix, the detection window starts at the upper left corner of the first-layer pyramid detection matrix, scale the pixels in the detection window, and keep moving the detection window until all the pixels in the first-layer pyramid detection matrix are scaled, so as to obtain a scaled first-layer pyramid detection matrix, and the scaled scaled first-layer pyramid detection matrix has a size of g1×g2; perform discrete cosine transform on the scaled first-layer pyramid detection matrix to obtain a processed first-layer pyramid detection matrix, and select a pixel with a size of g1×g2 from the processed first-layer pyramid detection matrix. a detection submatrix, calculating an average value of pixel values of the detection submatrix, and when the pixel value of the pixel in the first-layer pyramid detection matrix after processing is greater than the average value of the pixel value of the detection submatrix, setting the corresponding pixel in the first-layer pyramid detection matrix after processing to 1, otherwise setting the corresponding pixel in the first-layer pyramid detection matrix after processing to 0, and calculating a hash value of the detection submatrix;
[0105] S34, calculating the Hamming distance between the hash values of the initial pixel matrix and the detection submatrix, setting the distance threshold to ψ, when the Hamming distance between the hash values of the initial pixel matrix and the detection submatrix is less than or equal to ψ, the pixels in the detection submatrix are normal, otherwise the pixels in the detection submatrix are abnormal, mapping the detection submatrix to the initial pixel matrix, obtaining the coordinates of the abnormal pixels in the initial pixel matrix, forming a second abnormal area; marking the first abnormal area and the second abnormal area in the key detection pixel matrix, obtaining a defect marking matrix;
[0106] S4, training the FDNet neural network to obtain the FDNet network model, converting the defect annotation matrix into a final defect annotation image, using the FDNet network model for classification, and realizing flexible circuit board manufacturing defect detection through comprehensive judgment;
[0107] The S4 comprises the following steps:
[0108] S41, obtaining a new flexible circuit board image, marking defects on the new flexible circuit board image, obtaining a new defect labeling matrix, generating a defective flexible circuit board image and a non-defective flexible circuit board image from the new defect labeling matrix, dividing the defective flexible circuit board image and the non-defective flexible circuit board image into a defect training set and a defect test set, inputting the defect training set into the FDNet network for training, and continuously adjusting parameters until the FDNet network converges to obtain a trained FDNet network; then inputting the defect test set into the trained FDNet network, setting the defect detection accuracy threshold to ζ, and obtaining the FDNet network model when the accuracy of the trained FDNet network output result is less than ζ, otherwise repeating S41 until the accuracy of the trained FDNet network output result is less than ζ;
[0109] S42, converting the defect annotation matrix into a final defect annotation image, inputting the final defect annotation image into the FDNet network model, and outputting the probability of the final defect annotation image being classified as defective and the probability of the final defect annotation image being classified as non-defective; setting the defect probability of the final defect annotation image to h1, and the non-defect probability of the final defect annotation image to h2, the comprehensive judgment formula F is as follows:
[0110]
[0111] The comprehensive judgment threshold is set to σ. When the result of the comprehensive judgment formula is less than σ, the final defect annotation image has no defects and the flexible circuit board manufacturing has no defects. Otherwise, the final defect annotation image has defects and the flexible circuit board manufacturing has defects, and the flexible circuit board manufacturing defect detection is completed.
[0112] The present invention also discloses a system for a flexible circuit board manufacturing defect detection method based on artificial intelligence, which specifically includes: a flexible circuit board detection matrix preprocessing module, a suspected defect pixel location module, a flexible circuit board detection matrix defect annotation module and a network model defect detection module;
[0113] The flexible circuit board detection matrix preprocessing module is used to perform improved median filtering, grayscale transformation and sharpening processing on the flexible circuit board detection matrix;
[0114] The suspected defect pixel location module is used to determine and locate the suspected defect pixel based on the local Markov model;
[0115] The flexible circuit board detection matrix defect annotation module is used to construct a pyramid detection matrix, locate abnormal areas through mapping and mark defects;
[0116] The network model defect detection module is used to train the FDNet neural network and then use the FDNet network model to make judgments to achieve flexible circuit board manufacturing defect detection.
[0117] In the description of this specification, the description with reference to the terms "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0118] The preferred embodiments of the invention disclosed above are only used to help explain the invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the invention, so that those skilled in the art can understand and use the invention well.
Claims
1. A method for detecting defects in manufacturing flexible circuit boards based on artificial intelligence, characterized in that: The steps include: S1, acquiring a flexible circuit board image, generating a flexible circuit board detection matrix, and performing improved median filtering, grayscale transformation and sharpening processing on the flexible circuit board detection matrix to obtain a processed flexible circuit board detection matrix; S2, dividing the processed flexible circuit board detection matrix, obtaining a sub-flexible circuit board detection matrix, and then selecting candidate pixels, and then based on the local Markov algorithm model, establishing a k-order local Markov model in the eight-neighborhood of the candidate pixels, and determining the suspected defective pixels by the state probability of the k-order local Markov model to obtain a key detection pixel matrix; S3, constructing a pyramid detection matrix according to the key detection pixel matrix, comparing the key detection pixel matrix and the pyramid detection matrix based on the similarity principle, locating the abnormal area of the key detection pixel matrix by mapping and marking, and obtaining a defect marking matrix; The step of constructing a pyramid detection matrix according to the key detection pixel matrix comprises the following steps: A pyramid detection matrix is constructed according to the key detection pixel matrix, the number of pyramid layers is set to e, the 0th layer pyramid detection matrix is recorded as the initial pixel matrix, the 1st layer pyramid detection matrix is obtained by smoothing the 0th layer pyramid detection matrix, and the size of the 1st layer pyramid detection matrix is half of the 0th layer pyramid detection matrix, the 2nd layer pyramid detection matrix is obtained by smoothing the 1st layer pyramid detection matrix, and the size of the 2nd layer pyramid detection matrix is half of the 1st layer pyramid detection matrix, and the pyramid detection matrices are obtained in sequence; S4. Train the FDNet neural network to obtain the FDNet network model, convert the defect annotation matrix into a final defect annotation image, use the FDNet network model for classification, and realize flexible circuit board manufacturing defect detection through comprehensive judgment.
2. The method for detecting manufacturing defects of flexible circuit boards based on artificial intelligence according to claim 1, characterized in that: The S1 comprises the following steps: S11, acquiring a flexible circuit board image, generating a flexible circuit board detection matrix, and performing an improved median filtering process on the flexible circuit board detection matrix to obtain a filtered flexible circuit board detection matrix; S12, processing the grayscale change of the filtered flexible circuit board detection matrix to obtain a grayscale transformed flexible circuit board detection matrix; S13. Sharpening the grayscale transformed flexible circuit board detection matrix based on the bicubic difference method to obtain a processed flexible circuit board detection matrix.
3. The method for detecting manufacturing defects of flexible circuit boards based on artificial intelligence according to claim 2, characterized in that: The S11 comprises the following steps: S111, setting a filtering window, arranging the grayscale values of the pixels in the filtering window in descending order, selecting an intermediate grayscale value, and using the intermediate grayscale value to replace the grayscale value of the central pixel of the filtering window, thereby completing the first filtering process; S112, moving the filter window, repeating S111 until the grayscale values of all pixels in the flexible circuit board detection matrix are replaced, and the median filtering process is completed.
4. The artificial intelligence-based flexible circuit board manufacturing defect detection method according to claim 3 is characterized in that: The S2 comprises the following steps: S21, dividing the processed flexible circuit board detection matrix to obtain a sub-flexible circuit board detection matrix, extracting pixels from the sub-flexible circuit board detection matrix to obtain a candidate pixel point set; S22. Record the eight neighboring pixels around the pixel in the candidate pixel set as the eight-neighborhood of the pixel, establish a k-order local Markov model in the eight-neighborhood of the pixel, obtain the probability of using the k-order local Markov model in state B″′, and use the probability of the k-order local Markov model in state B″′ to determine whether the pixel in the eight-neighborhood of the pixel is a suspected defective pixel; and form the suspected defective pixels into a key detection pixel matrix.
5. The method for detecting manufacturing defects of flexible circuit boards based on artificial intelligence according to claim 4, characterized in that: The probability of the k-order local Markov model in state B″′ is used to judge the pixel points in the eight-neighborhood of the pixel point. When the probability of the pixel point in the eight-neighborhood of the pixel point in state B″′ is less than 0.5, the pixel point in the eight-neighborhood of the pixel point is recorded as a suspected defective pixel point. When the probability of the pixel point in the eight-neighborhood of the pixel point in state B″′ is greater than or equal to 0.5, the pixel point in the eight-neighborhood of the pixel point is not a suspected defective pixel point.
6. The method for detecting manufacturing defects of flexible circuit boards based on artificial intelligence according to claim 5, characterized in that: The S3 comprises the following steps: S31, constructing a pyramid detection matrix according to the key detection pixel matrix, setting the number of pyramid layers to e, and recording the 0th layer pyramid detection matrix as the initial pixel matrix; S32, for the second-layer pyramid detection matrix and the first-layer pyramid detection matrix, based on the similarity principle, locate the abnormal pixel points of the second-layer pyramid detection matrix and the first-layer pyramid detection matrix, and then map the abnormal pixel points to the initial pixel point matrix to obtain a first abnormal area and a second abnormal area; S33, marking the first abnormal area and the second abnormal area in the key detection pixel matrix to obtain a defect marking matrix.
7. The method for detecting manufacturing defects of flexible circuit boards based on artificial intelligence according to claim 4, characterized in that: The S4 comprises the following steps: S41, obtaining a new flexible circuit board image, marking defects on the new flexible circuit board image, obtaining a new defect labeling matrix, generating a defective flexible circuit board image and a non-defective flexible circuit board image from the new defect labeling matrix, dividing the defective flexible circuit board image and the non-defective flexible circuit board image into a defect training set and a defect test set, inputting the defect training set into the FDNet network for training, and continuously adjusting parameters until the FDNet network converges to obtain a trained FDNet network; then inputting the defect test set into the trained FDNet network, setting the defect detection accuracy threshold to ζ, and obtaining the FDNet network model when the accuracy of the trained FDNet network output result is less than ζ, otherwise repeating S41 until the accuracy of the trained FDNet network output result is less than ζ; S42, converting the defect annotation matrix into a final defect annotation image, inputting the final defect annotation image into the FDNet network model, outputting the probability of the final defect annotation image being classified as defective and the probability of the final defect annotation image being classified as non-defective; based on comprehensive judgment, realizing defect detection in flexible circuit board manufacturing.
8. The artificial intelligence-based flexible circuit board manufacturing defect detection method according to claim 7, characterized in that: The comprehensive judgment threshold is set to σ. When the comprehensive judgment result is less than σ, the final defect annotation image has no defects and the flexible circuit board manufacturing has no defects. Otherwise, the final defect annotation image has defects and the flexible circuit board manufacturing has defects, and the flexible circuit board manufacturing defect detection is completed.
9. A system for implementing the artificial intelligence-based flexible circuit board manufacturing defect detection method as described in any one of claims 1 to 8, characterized in that: Specifically include: Flexible circuit board detection matrix preprocessing module, suspected defect pixel location module, flexible circuit board detection matrix defect annotation module and network model defect detection module; The flexible circuit board detection matrix preprocessing module is used to perform improved median filtering, grayscale transformation and sharpening processing on the flexible circuit board detection matrix; The suspected defect pixel location module is used to determine and locate the suspected defect pixel based on the local Markov model; The flexible circuit board detection matrix defect annotation module is used to construct a pyramid detection matrix, locate abnormal areas through mapping and mark defects; The network model defect detection module is used to train the FDNet neural network and then use the FDNet network model to make judgments to achieve flexible circuit board manufacturing defect detection.
Citation Information
Patent Citations
CNN (Convolutional Neural Network)-based flexible-printed-circuit(FPC) appearance defect detection method
CN109239102A
Weld seam internal defect intelligent detection device and method, and medium
WO2022053001A1