A method and system for detecting surface defects of a circuit board

By combining deep learning models and timing dynamic analysis, efficient and accurate detection of small defects and complex backgrounds on the surface of the circuit board is achieved, solving the problems of high error rate, low efficiency and poor adaptability in traditional methods, and improving the accuracy and adaptability of the detection.

CN119941726BActive Publication Date: 2025-07-22SHENZHEN ZHENGTIANWEI TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510422549.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-07
Publication Date
2025-07-22
Estimated Expiration
2045-04-07

AI Technical Summary

Technical Problem

Traditional circuit board defect detection methods rely on manual inspection and inefficient image processing, which have high error rate, low efficiency, unrecognized small defects and defects in complex backgrounds, lack of intelligence and adaptability, and are slow in response, making it difficult to meet the needs of modern large-scale production.

Method used

The combined deep learning model of YOLOv5 and SE-ResNet is adopted, combined with multi-scale feature fusion technology and timing dynamic analysis, and dynamic detection strategies are dynamically adjusted through region growth algorithms, channel attention mechanisms and adaptive activation functions to achieve accurate identification and detection of tiny defects and complex backgrounds on the circuit board surface.

Benefits of technology

It improves the accuracy and robustness of defect detection, significantly improves the quality and efficiency of circuit board detection, can adapt to defects in different types and evolutionary processes, and reduces error detection and missed detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119941726B_ABST
    Figure CN119941726B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for detecting surface defects of a circuit board, including the following steps: collecting an image of the circuit board surface, preprocessing the image to generate defect candidate regions, combining a deep learning model, using an object detection network and a channel attention mechanism to extract image features, locating and classifying potential defect regions, adopting a multi-scale feature fusion technology to optimize by combining image features of different scales, predicting the defect evolution trend using temporal dynamic analysis, and dynamically adjusting the defect detection strategy according to the prediction results. The system of the present invention adopts a multi-module collaboration method, has high flexibility and adaptability, and can achieve efficient and accurate detection of minute defects on the circuit board surface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of defect detection, and particularly to a method and system for detecting surface defects of a circuit board. Background Art

[0002] With the wide application of electronic devices, as the core component of electronic products, the quality of circuit boards directly affects the performance and stability of the devices. Timely detection and repair of surface defects of circuit boards are important links to ensure the reliability and production efficiency of electronic products. Traditional methods for detecting circuit board defects mainly rely on manual inspection and automated detection based on simple image processing, which have certain limitations.

[0003] In the prior art, traditional methods for detecting circuit board defects usually rely on manual experience or inefficient image processing algorithms. These methods have obvious defects in the following aspects:

[0004] 1. Dominated by manual inspection: Manual inspection relies on manual operation, has a high error rate, and is inefficient, unable to meet the requirements of modern large-scale production.

[0005] 2. Limited image processing ability: Existing detection methods based on traditional image processing usually can only identify the significant features of surface defects, ignoring the identification of tiny defects and defects in complex backgrounds, resulting in frequent false detection and missed detection phenomena.

[0006] 3. Lack of intelligence and adaptability: Most traditional methods lack deep learning and adaptive mechanisms, and it is difficult to dynamically adjust the detection strategy according to different evolution trends of defects, and it is difficult to adapt to complex production environments and diverse defect types.

[0007] 4. Slow response speed: Traditional methods often cannot provide real-time detection and rapid feedback when facing fast production and high-precision requirements, resulting in limited production efficiency.

[0008] Therefore, how to provide a method and system for detecting surface defects of a circuit board is an urgent problem to be solved by those skilled in the art. Summary of the Invention

[0009] An object of the present invention is to provide a method and system for detecting surface defects of a circuit board. The present invention makes full use of the combined deep learning model of YOLOv5 and SE-ResNet, multi-scale feature fusion technology, and temporal dynamic analysis. By performing multi-level feature extraction, weighted fusion, and adaptive activation on the surface image of the circuit board, it can accurately identify the defect areas in tiny defects and complex backgrounds, and dynamically adjust the detection strategy according to the defect evolution trend, having the advantages of high efficiency, precision, and intelligent adaptation.

[0010] A method for detecting surface defects of a circuit board according to an embodiment of the present invention includes the following steps:

[0011] S1. Obtain the original image data of the circuit board surface, and perform preprocessing on the original image data, including denoising, contrast enhancement, and normalization processing, to generate a preprocessed image;

[0012] S2. Apply a region growing algorithm to the preprocessed image, judge and expand the defect area by the similarity of adjacent pixels in the image, automatically expand and mark the potential defect area, and generate a defect candidate area layer;

[0013] S3. Input the defect candidate area layer and the preprocessed image into a pre-constructed deep learning model that combines a target detection network and a channel attention mechanism, use the deep learning model to identify defects in the preprocessed image, and accurately locate the type and position of the defect area; and S4. On the basis of the deep learning model, use a multi-scale feature fusion mechanism to extract and fuse the features of the preprocessed image at different scales, process the fused different-scale feature maps, and detect tiny defects and details in complex backgrounds;

[0014] S5. Perform temporal dynamic analysis on the defect areas identified by the deep learning model, predict the evolution trend of the defects based on the historical evolution data set of the defect areas, and adjust the preset defect detection strategy according to the prediction results;

[0015] S6. Build an edge computing platform, implement a distributed defect detection system on the edge computing platform, allocate the image processing and defect analysis tasks to multiple distributed defect detection systems, and complete the circuit board defect detection task in real time.

[0016] Optionally, the S2 specifically includes:

[0017] S21. Divide the preprocessed image into multiple pixel units, each pixel unit includes a target pixel and its adjacent pixels, define the initial pixel point as

[0018] S22. Calculate the similarity metric function S23. Calculate the similarity metric function between the target pixel and its adjacent pixel is defined as the neighborhood set ;

[0019] S22. Calculate the similarity metric function between the target pixel and its adjacent pixel This similarity metric function combines the gray value of the target pixel , Color value and texture feature value Difference:

[0020] ;

[0021] Among them, , , are the weighting coefficients of grayscale, color, and texture features respectively, represents the pixel adjacent to the target pixel grayscale value, represents the pixel adjacent to the target pixel color value, represents the pixel adjacent to the target pixel texture feature value, represents the absolute value operation;

[0022] S23. Set the similarity measurement threshold , when the similarity measurement function of the target pixel and the adjacent pixel is less than or equal to the similarity measurement threshold , it is considered that the adjacent pixel belongs to the defect area where the target pixel is located;

[0023] S24. Adopt the region growing algorithm, starting from each initial pixel point , and according to the similarity measurement function and the set similarity measurement threshold , gradually expand the adjacent pixel , and include the adjacent pixel that meets the conditions into the expanded defect area , until the region growing is completed;

[0024] S25. Screen the expanded defect area , and eliminate the areas with too small area and too large overlap with other defect areas. The elimination criteria are judged by calculating the area of the defect area and the overlap degree :

[0025] ;

[0026] Among them, refers to another defect area for overlapping degree comparison with the expanded defect area ;

[0027] S26. Mark the expanded defect regions that meet the conditions, identify them as potential defect regions, and generate a defect candidate region layer.

[0028] Optionally, the specific steps of S3 are as follows:

[0029] S31. Merge the defect candidate region layer with the preprocessed image and input it into a deep learning model. The deep learning model includes an object detection network and a channel attention mechanism for feature extraction and object detection to optimize the channel attention of the image features and generate a composite image input.

[0030] S32. Perform normalization processing on the composite image input, including gray normalization, color normalization, and texture enhancement, to realize the expression of multi-scale features in the deep learning model and optimize the sensitivity of the micro defect regions.

[0031] S33. Input the normalized composite image into the network for forward propagation to extract multi-level features of the image through convolutional neural network layers, perform region prediction based on preset anchor boxes, and generate the confidence, position coordinates, and size information of each potential defect region.

[0032] S34. Apply the channel attention mechanism to adjust the multi-level features of the image, dynamically adjust the influence of each part of the image by calculating the attention weights of each channel, accurately locate the defect regions, and optimize the feature expression of the defect regions.

[0033] S35. Post-process the defect region information output by the joint model. Set a confidence threshold to screen the results, eliminate the detection regions with low confidence, and classify the detected defect regions according to the confidence, position coordinates, and size information of the defect regions to identify the types of defect regions.

[0034] Optionally, the specific steps of S4 are as follows:

[0035] S41. Based on the deep learning model, use a multi-scale feature fusion mechanism to extract features of various scales from the preprocessed image, and obtain image features from low-level and high-level through a convolutional neural network and a multi-level feature pooling structure to generate a multi-scale feature map ;

[0036] S42. For the multi-scale feature map ​Perform standardization processing, calculate the mean and standard deviation of the feature maps at each scale, and perform zero-mean unit-variance normalization:

[0037] ;

[0038] Among them, and are the mean and standard deviation of the feature maps at each scale, is the multi-scale feature map after standardization;

[0039] S43. Perform multi-level convolution processing on the multi-scale feature map after standardization. Use a convolutional neural network with a pyramid structure to extract detailed features at different levels, and fuse the low-level and high-level image features to generate a global information feature map , optimizing the perception ability for micro-defects and complex backgrounds;

[0040] S44. Use a weighted fusion mechanism to perform weighted processing on the global information feature map , adjust the contribution ratio of the detailed features at different levels, and the weighting coefficient is calculated according to the similarity between each layer of the global information feature map and the defect area:

[0041] ;

[0042] Among them, is the similarity measure between the -th layer of the global information feature map and the defect area, is a hyperparameter for controlling the weighting coefficient, and the weighted feature map optimizes the influence of high-level features in defect area recognition through layer-by-layer weighting, is the similarity measure between the -th layer of the global information feature map and the defect area;

[0043] S45. Based on the weighted feature map , apply an adaptive activation function , and optimize the performance of important regions in the image by dynamically adjusting the feature values of each defect area:

[0044] ;

[0045] Among them, is the feature map after adaptive activation, is a non-linear activation function, is element-wise multiplication, It is a dynamic weight map calculated based on the attention mechanism, which can perform dynamic weighting according to the feature importance of local regions of the image;

[0046] S46. Perform post-processing on the feature map after adaptive activation to screen out the feature defect regions that meet the confidence threshold . The confidence threshold controls the confidence of the detected potential defect regions. After eliminating the low-confidence regions, classify the detected defect regions according to the confidence, position coordinates, and size information of the remaining defect regions, and identify the specific defect region types and positions:

[0047] ;

[0048] Among them, is the set of screened defect regions, is the confidence of the defect region.

[0049] Optionally, the specific steps of S45 include:

[0050] S451. On the basis of the weighted feature map , apply the adaptive activation function to optimize the performance of important defect regions in the image by dynamically adjusting the feature values of each defect region;

[0051] S452. Calculate the attention degree of each region in the weighted feature map to generate the dynamic weight map :

[0052] ;

[0053] Among them, and are the mean and standard deviation of the weighted feature map respectively, is the activation function;

[0054] S453. Multiply the dynamic weight map element-wise with the weighted feature map to generate the adaptive activation feature map , optimize the contribution of important feature regions and suppress the influence of irrelevant regions by dynamically adjusting the response values of each region:

[0055] S454. Perform post-processing on the adaptive activation feature map to further optimize the image features by analyzing the context information of local regions, optimize the expression of defect regions, and refine the detection effect of defect regions;

[0056] S455. Perform precise detection and classification of the defect regions on the feature map after adaptive activation and post-processing. Based on the adaptively activated feature map, identify potential defect regions, and classify the defects according to the confidence level, position coordinates, and size information of the defect regions to determine the type and precise location of the defects. Perform precise detection and classification of the defect regions. Based on the adaptively activated feature map, identify potential defect regions, and classify the defects according to the confidence level, position coordinates, and size information of the defect regions to determine the type and precise location of the defects.

[0057] Optionally, the S5 specifically includes:

[0058] S51. Perform temporal dynamic analysis on the defect regions identified by the deep learning model, obtain the change data of the defect regions at different time points, and construct a historical evolution dataset , where , is the defect region detected at time , is the set of time series, representing the evolution trajectory of the defect region on the time axis;

[0059] S52. Use a temporal modeling algorithm to model the historical evolution dataset , and use a long short-term memory network to learn the evolution law of the defect region in the time dimension to obtain a temporal feature vector , where represents the defect evolution feature generated by the temporal network, reflecting the change trend of the defect region on the time axis, represents the defect evolution feature function;

[0060] S53. Process the temporal feature vector to extract the key dynamic features in the evolution process of the defect region, and obtain a defect evolution trend prediction value , where , is the prediction function, indicating that by learning the historical evolution features, the evolution trend and change direction of the future defect region are predicted;

[0061] S54. Based on the defect evolution trend prediction value , infer the future evolution state of the defect region, and dynamically adjust the preset defect detection strategy according to the evolution trend. The adjustment of the defect detection strategy is based on the historical evolution dataset and the temporal feature vector , and form a new defect detection strategy by adjusting the size of the detection time window, detection threshold, region division, and feature extraction method, , where is the detection strategy adjustment function, is the adjusted detection strategy;

[0062] S55. According to the adjusted detection strategy Perform defect detection on the image features after multi-level feature fusion and temporal dynamic analysis and adjustment, optimize the region selection, feature extraction, and model parameters during defect detection, and gradually optimize according to the evolution trend of the current defect region to ensure the consistency of the detection results for the defect region at different time nodes, and obtain the final detection result set. Among them is the optimized detected defect region, is the finally recognized region set.

[0063] Optionally, a circuit board surface defect detection system includes the following modules:

[0064] Data acquisition module: Real-time collect the image data on the circuit board surface and generate the original image data;

[0065] Preprocessing module: Denoise, enhance the contrast, and standardize the collected original image data to generate the preprocessed image;

[0066] Deep learning model module: Adopt the object detection network and the deep learning model with channel attention mechanism to identify and locate the defect candidate region layer, extract features through the convolutional neural network, and detect the defect types and positions on the circuit board;

[0067] Temporal dynamic analysis module: Perform temporal dynamic analysis based on the historical evolution data set of the defect region, use the temporal dynamic analysis method to predict the evolution trend of the defect, and adjust the preset defect detection strategy according to the prediction result;

[0068] Defect detection module: Based on the historical data of the defect region, apply the prediction model to calculate the future evolution trend of the defect and assist the system to dynamically adjust the detection strategy;

[0069] Defect detection strategy adjustment module: Dynamically adjust the defect detection strategy according to the prediction result of the defect evolution trend, and optimize the parameter settings and detection methods during the defect detection process;

[0070] Final detection result output module: Based on the detection result of the defect region by the deep learning model and the prediction of the defect evolution trend by the temporal dynamic analysis module, comprehensively process all detection information and generate the final defect detection result.

[0071] The beneficial effects of the present invention are:

[0072] (1) By combining the YOLOv5 and SE-ResNet joint deep learning model, multi-scale feature fusion technology, and temporal dynamic analysis method, the present invention can efficiently identify and classify tiny defects and defect areas in complex backgrounds in the surface images of circuit boards. Through precise feature extraction and dynamic adjustment, this method improves the accuracy and robustness of defect detection, significantly enhancing the quality and efficiency of circuit board detection.

[0073] (2) Through multi-level feature map fusion and adaptive activation functions, the present invention effectively optimizes the performance of important regions in the image, enabling the system to more accurately identify tiny defects on the surface of the circuit board. This not only improves the accuracy of defect recognition but also enhances the system's ability to perceive details in complex backgrounds.

[0074] (3) By combining defect evolution trend prediction and dynamic adjustment of detection strategies, the system can timely adjust the detection scheme according to historical data to adapt to different types and evolution processes of defects. This innovative method further improves the adaptability of defect detection, reducing false detections and missed detections. Description of the Drawings

[0075] The drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation to the present invention. In the drawings:

[0076] Figure 1 is the overall framework diagram of a method and system for detecting defects on the surface of a circuit board proposed by the present invention. Detailed Embodiments

[0077] Now, the present invention will be further described in detail with reference to the drawings. These drawings are all simplified schematic diagrams, only illustrating the basic structure of the present invention in a schematic manner, so they only show the components related to the present invention.

[0078] Refer to Figure 1 , a method for detecting defects on the surface of a circuit board, comprising the following steps:

[0079] S1. Obtain the original image data of the circuit board surface, preprocess the original image data, including denoising, contrast enhancement, and normalization processing, to generate a preprocessed image;

[0080] S2. Apply the region growing algorithm to the preprocessed image, judge and expand the defect area by the similarity of adjacent pixels in the image, automatically expand and mark the potential defect area, and generate a defect candidate area layer;

[0081] S3. Input the defect candidate area layer and the preprocessed image into a pre-constructed fusion Target detection network and A deep learning model with a channel attention mechanism uses the deep learning model to identify defects in the preprocessed image and accurately locate the type and position of the defect area;

[0082] S4. Based on the deep learning model, use a multi-scale feature fusion mechanism to extract and fuse the features of the preprocessed image at different scales, process the different-scale feature maps obtained by fusion, and detect tiny defects and details in complex backgrounds;

[0083] S5. Perform temporal dynamic analysis on the defect areas identified by the deep learning model, predict the evolution trend of the defects based on the historical evolution dataset of the defect areas, and adjust the preset defect detection strategy according to the prediction results;

[0084] S6. Build an edge computing platform, implement a distributed defect detection system on the edge computing platform, allocate image processing and defect analysis tasks to multiple distributed defect detection systems, and complete the circuit board defect detection task in real time.

[0085] In this embodiment, S2 specifically includes:

[0086] S21. Divide the preprocessed image into multiple pixel units. Each pixel unit includes a target pixel and its adjacent pixels. Define the initial pixel point as , the target pixel is , and the relationship between the target pixel and its adjacent pixel is defined as the neighborhood set ;

[0087] S22. Calculate the similarity metric function between the target pixel and its adjacent pixel . This similarity metric function combines the gray value , color value , and texture feature value of the target pixel differences:

[0088] ;

[0089] Among them, , , are the weighting coefficients of gray, color, and texture features respectively, represents the gray value of the pixel adjacent to the target pixel , represents the gray value of the pixel adjacent to the target pixel The color value, represents the pixel adjacent to the target pixel in terms of texture feature value, represents the absolute value operation;

[0090] S23. Set the similarity measurement threshold such that when the similarity measurement function between the target pixel and the adjacent pixel is less than or equal to the similarity measurement threshold , the adjacent pixel is considered to belong to the defect area where the target pixel is located;

[0091] S24. Employ the region growing algorithm to start from each initial pixel point and, based on the similarity measurement function and the set similarity measurement threshold , gradually expand the adjacent pixels and incorporate the adjacent pixels that meet the conditions into the expanded defect area until the region growing is completed;

[0092] S25. Screen the expanded defect area by removing areas with too small an area and areas with too large an overlap with other defect areas. The screening criteria are determined by calculating the area of the defect area and the overlap as follows:

[0093] ;

[0094] wherein, refers to another defect area for comparing the overlap with the expanded defect area ;

[0095] S26. Mark the expanded defect area that meets the conditions, identify it as a potential defect area, and generate a defect candidate area layer.

[0096] In this embodiment, by combining the gray scale, color, and texture features of the target pixel and the adjacent pixel, calculating the similarity measurement function, and using the region growing algorithm to expand the defect area, potential defects on the circuit board surface can be accurately identified. By removing areas that do not meet the conditions and screening out effective defect areas, the accuracy and precision of defect detection are improved, ensuring the efficiency and reliability of defect identification.

[0097] In this embodiment, S3 specifically includes:

[0098] S31. Merge the defect candidate region layer with the preprocessed image and input it into a deep learning model, which includes an object detection network and a channel attention mechanism for feature extraction and object detection, for optimizing the channel attention of image features to generate a composite image input;

[0099] S32. Perform normalization processing on the composite image input, including grayscale normalization, color normalization, and texture enhancement, to realize the expression of multi-scale features in the deep learning model and optimize the sensitivity of the micro-defect region;

[0100] S33. Input the normalized composite image into the network for forward propagation, extract multi-level features of the image through convolutional neural network layers, perform region prediction based on preset anchor boxes, and generate the confidence, position coordinates, and size information of each potential defect region;

[0101] S34. Apply the channel attention mechanism to adjust the multi-level features of the image. By calculating the attention weights of each channel, dynamically adjust the influence of each part in the image, accurately locate the defect region, and optimize the feature expression of the defect region;

[0102] S35. Perform post-processing on the defect region information output by the joint model. Set a confidence threshold to screen the results, eliminate the detection regions with low confidence, and classify the detected defect regions according to the confidence, position coordinates, and size information of the defect regions to identify the types of defect regions.

[0103] In this embodiment, by combining the object detection network and the channel attention mechanism, the detection process of the surface defects of the circuit board is optimized. By extracting multi-level features of the image through the deep learning model and dynamically adjusting the influence of each part of the image, the detection sensitivity of micro-defects is significantly improved. This method can accurately locate the defect region and classify and identify it, providing an efficient and accurate surface defect detection ability for the circuit board.

[0104] In this embodiment, S4 specifically includes:

[0105] S41. Based on the deep learning model, use the multi-scale feature fusion mechanism to extract features of each scale from the preprocessed image. Through the convolutional neural network and the multi-level feature pooling structure, obtain the image features from the low level and the high level, and generate a multi-scale feature map ;

[0106] S42. Normalize the multi-scale feature maps by calculating the mean and standard deviation for each scale of the feature maps and performing zero-mean unit-variance normalization:

[0107] ;

[0108] where and are the mean and standard deviation of each scale of the feature maps, and is the normalized multi-scale feature map;

[0109] S43. Perform multi-level convolution processing on the normalized multi-scale feature maps using a convolutional neural network with a pyramid structure to extract detailed features at different levels and fuse the low-level and high-level image features to generate a global information feature map to optimize the perception ability for micro-defects and complex backgrounds;

[0110] S44. Use a weighted fusion mechanism to weight the global information feature map and adjust the contribution ratio of the detailed features at different levels. The weighting coefficient is calculated according to the similarity between each layer of the global information feature map and the defect area:

[0111] ;

[0112] where is the similarity measure between the -th layer of the global information feature map and the defect area, is a hyperparameter controlling the weighting coefficient, and the weighted feature map optimizes the influence of high-level features in defect area recognition through layer-by-layer weighting. is the similarity measure between the -th layer of the global information feature map and the defect area;

[0113] S45. Based on the weighted feature map , apply an adaptive activation function to optimize the performance of important regions in the image by dynamically adjusting the feature values of each defect area:

[0114] ;

[0115] where is the feature map after adaptive activation, is a non-linear activation function, is element-wise multiplication, is a dynamic weight map calculated based on the attention mechanism, which can perform dynamic weighting according to the feature importance of local regions of the image;

[0116] S46. Post-process the feature map after adaptive activation to screen out the feature defect regions that meet the confidence threshold . The confidence threshold controls the confidence of the detected potential defect regions. After removing the low-confidence regions, according to the confidence, position coordinates, and size information of the remaining defect regions, classify the detected defect regions to identify the specific defect region types and positions:

[0117] ;

[0118] Among them, is the set of screened defect regions, is the confidence of the defect regions.

[0119] In this embodiment, by combining the multi-scale feature fusion mechanism and the weighted fusion strategy, the detection accuracy of the surface defects of the circuit board is optimized. The application of multi-level convolution processing and the adaptive activation function enables the system to accurately identify the detailed features at different levels, dynamically adjust the performance of the defect regions, improve the perception ability of micro-defects and complex backgrounds, and at the same time improve the accuracy of defect classification and positioning.

[0120] In this embodiment, S45 specifically includes:

[0121] S451. On the basis of the weighted feature map , apply the adaptive activation function to optimize the performance of the important defect regions in the image by dynamically adjusting the feature values of each defect region;

[0122] S452. Calculate the attention degree of each region in the weighted feature map to generate the dynamic weight map :

[0123] ;

[0124] Among them, and are respectively the mean and standard deviation of the weighted feature map , is the activation function;

[0125] S453. Element-wise multiply the dynamic weight map with the weighted feature map to generate the adaptive activation feature map , by dynamically adjusting the response values of each region, optimizing the contributions of important feature regions, and suppressing the influence of irrelevant regions:

[0126] S454. Post-process the self-adaptive activation feature map , and further optimize the image features by analyzing the context information of local regions, optimize the expression of defect regions, and refine the detection effect of defect regions;

[0127] S455. Precisely detect and classify defect regions in the feature map after self-adaptive activation and post-processing . Based on the self-adaptive activation feature map, identify potential defect regions, and classify the defects according to the confidence level, position coordinates, and size information of the defect regions to determine the type and precise location of the defects.

[0128] In this embodiment, by introducing a self-adaptive activation function and a dynamic weight map, the feature values of defect regions can be dynamically adjusted, thereby optimizing the performance of key defect regions and suppressing the influence of irrelevant regions. By precisely adjusting the response values of each region, the detection accuracy and classification accuracy of defect regions are significantly improved, and the robustness and refinement ability of the defect detection system in complex backgrounds are enhanced.

[0129] In this embodiment, S5 specifically includes:

[0130] S51. Perform temporal dynamic analysis on the defect regions identified by the deep learning model, obtain the change data of the defect regions at different time points, and construct a historical evolution dataset , where , is the defect region detected at time , and is a set of time series, representing the evolution trajectory of the defect region on the time axis;

[0131] S52. Use a temporal modeling algorithm to model the historical evolution dataset , and use a long short-term memory network to learn the evolution law of the defect region in the time dimension to obtain a temporal feature vector , where represents the defect evolution feature generated by the temporal network, reflecting the change trend of the defect region on the time axis, represents the defect evolution feature function;

[0132] S53. Process the temporal feature vector , extract the key dynamic features in the evolution process of the defect region, and obtain a defect evolution trend prediction value , where , is a prediction function, which predicts the evolution trend and change direction of the future defect area by learning the historical evolution features;

[0133] S54. Based on the predicted value of the defect evolution trend , infer the future evolution state of the defect area, and dynamically adjust the preset defect detection strategy according to the evolution trend. The adjustment of the defect detection strategy is based on the historical evolution data set and the time series feature vector , and form a new defect detection strategy by adjusting the size of the detection time window, the detection threshold, the region division and the feature extraction method , where is the detection strategy adjustment function is the adjusted detection strategy;

[0134] S55. According to the adjusted detection strategy , perform defect detection on the image features after multi-level feature fusion and time series dynamic analysis adjustment, optimize the region selection, feature extraction and model parameters in the defect detection process, and gradually optimize according to the evolution trend of the current defect area to ensure the consistency of the detection results of the defect area at different time nodes, and obtain the final detection result set , where is the detected defect area after optimization is the set of finally identified regions.

[0135] In this embodiment, by introducing time series dynamic analysis and long short-term memory network, the evolution trend of the defect area is predicted, so as to realize the dynamic adjustment of the defect detection strategy. Through learning the historical evolution data set, the future evolution direction of the defect area can be accurately predicted, so as to optimize the region selection, feature extraction and model parameters in the detection process, improve the accuracy and stability of defect detection, and ensure the consistency of the detection results of the defect area at different time nodes.

[0136] In this embodiment, a circuit board surface defect detection system includes the following modules:

[0137] Data acquisition module: Real-time collect the circuit board surface image data and generate the original image data;

[0138] Preprocessing module: Denoise, enhance the contrast and standardize the collected original image data to generate the preprocessed image;

[0139] Deep learning model module: Adopt object detection network and The deep learning model with channel attention mechanism identifies and locates the defective candidate area layer, extracts features through a convolutional neural network, and detects the types and positions of defects on the circuit board;

[0140] Time-series dynamic analysis module: Conduct time-series dynamic analysis based on the historical evolution data of the defective area, use time-series dynamic analysis methods to predict the evolution trend of the defect, and adjust the defect detection strategy according to the prediction results;

[0141] Defect detection module: Based on the historical data of the defective area, apply a prediction model to calculate the future evolution trend of the defect, and assist the system in dynamically adjusting the detection strategy;

[0142] Defect detection strategy adjustment module: Dynamically adjust the defect detection strategy according to the prediction results of the defect evolution trend, and optimize the parameter settings and detection methods in the defect detection process;

[0143] Final detection result output module: Based on the detection results of the defective area by the deep learning model and the prediction of the defect evolution trend by the time-series dynamic analysis module, comprehensively process all detection information to generate the final defect detection result.

[0144] Example 1:

[0145] To verify the feasibility of the present invention in implementation, the present invention is applied to verify the actual application effect of the present invention in the detection of surface defects of circuit boards. The present invention is applied to the quality inspection laboratory of a large circuit board manufacturing enterprise. The circuit boards produced by this enterprise are of various types, covering multiple fields such as communication, computer, and consumer electronics. The enterprise needs to conduct surface defect detection on each batch of circuit boards to ensure that the product quality meets the industry standards. Traditional defect detection methods rely on manual visual inspection or algorithms based on traditional image processing. These methods have significant deficiencies in detection efficiency and accuracy. Especially when dealing with complex backgrounds and tiny defects, the false detection rate and missed detection rate of traditional methods are relatively high, resulting in unstable detection results, increasing production costs, and affecting the product shipment cycle. To solve these problems, the enterprise introduced the deep learning-based circuit board surface defect detection method proposed by the present invention. By combining deep neural networks, time-series dynamic analysis, and defect evolution trend prediction technologies, the defect detection process is optimized, and the detection accuracy and efficiency are improved.

[0146] In the experiment, the laboratory selected 100 groups of circuit board samples, covering different models of circuit boards. There are different types of defects on the samples, including cracks, holes, offsets, and short circuits, etc. The detection environments include two typical environments: normal temperature and high humidity. The image acquisition device used in the experiment is a high-resolution industrial camera, which can provide high-quality images of the circuit board surface under different lighting conditions. The image data is preprocessed through a deep learning model. The YOLOv5 and SE-ResNet combined deep learning model is used for feature extraction and defect recognition. At the same time, the weighted fusion mechanism and adaptive activation function are used to optimize the extracted features, and finally the weighted feature map is obtained. After defect recognition, further temporal dynamic analysis is carried out on the identified defect areas. The long short-term memory network is used to predict the evolution trend of the defect areas, and the defect detection strategy is dynamically adjusted.

[0147] After the laboratory performed defect detection through the method of the present invention, the obtained detection results were compared with the results of manual detection. The following are some experimental data:

[0148] Table 1 Comparison of Circuit Board Defect Detection Results

[0149] Defect type Detection method Detection accuracy Omission rate False detection rate Crack Traditional method 85% 10% 8% Crack Method of the present invention 98% 2% 3% Hole Traditional method 82% 12% 5% Hole Method of the present invention 95% 4% 2% Offset Traditional method 80% 15% 7% Offset Method of the present invention 96% 3% 1%

[0150] The experimental data shows that the method of the present invention has shown significant advantages in various defect detections. Especially in the identification of micro-defects, the detection accuracy has been improved by 13% to 18%, and the missed detection rate and false detection rate have been greatly reduced. Through temporal dynamic analysis and defect evolution trend prediction, the method of the present invention can predict the evolution of defects in advance and dynamically adjust the detection strategy, thus avoiding missed detections and false detections in complex environments.

[0151] In order to further verify the advantages of the method of the present invention, the laboratory compared the defect detection efficiency before and after introducing the technology of the present invention:

[0152] Table 2 Comparison of Defect Detection Efficiency

[0153] Detection scenario Average detection time (seconds) Detection time per batch (minutes) Improvement in detection accuracy (%) Traditional method 90 30 - Method of the present invention 45 15 35

[0154] As can be seen from Table 2, the method of the present invention shortens the single detection time from 90 seconds of the traditional method to 45 seconds, and the detection time per batch is reduced from 30 minutes to 15 minutes, and the detection accuracy is improved by 35%. This significant efficiency improvement makes the defect detection of circuit boards in large-scale production more efficient and meets the quality control requirements of enterprises in batch production.

[0155] To further demonstrate the actual application effect of the present invention, the laboratory also analyzed the detection results in multiple environments. The test environments in the experiment included normal temperature and high humidity conditions. In a high humidity environment, water droplets or haze are likely to form on the surface of the circuit board, and traditional defect detection methods are often interfered with, resulting in an increase in the false detection rate and missed detection rate. The present invention effectively improves the detection stability in a humid environment by combining temporal dynamic analysis and an adaptive activation function to optimize image features. The following are the detection data in a high humidity environment:

[0156] Table 3 Defect Detection Effect in High Humidity Environment

[0157] Defect type Detection accuracy of traditional method Detection accuracy of method of the present invention Crack 70% 96% Hole 75% 93% Offset 65% 90%

[0158] The experimental data show that in a high humidity environment, the method of the present invention significantly improves the accuracy of defect detection compared with the traditional method. Especially in complex environmental conditions, the system can better adapt to environmental changes and improve the detection stability.

[0159] In summary, the present invention not only solves the problems of low efficiency, serious false detection and missed detection of traditional defect detection methods, but also makes the defect detection process more intelligent and adaptive by introducing temporal dynamic analysis and defect evolution prediction technology. The significant improvement in detection accuracy and efficiency greatly reduces the production cost and improves the quality and shipping speed of circuit board products.

[0160] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention, according to the technical solution and inventive concept of the present invention, makes equivalent substitutions or changes, and should be covered by the protection scope of the present invention.

Claims

1. A method for detecting surface defects of a circuit board, characterized in that, It includes the following steps: S1. Obtain the original image data of the circuit board surface, and preprocess the original image data, including denoising, contrast enhancement, and normalization processing, to generate a preprocessed image; S2. Apply the region growing algorithm to the preprocessed image, judge and expand the defect area by the similarity of adjacent pixels in the image, automatically expand and mark the potential defect area, and generate a defect candidate area layer; S3. Input the defective candidate region layer and the preprocessed image into a pre-constructed deep learning model that fuses a target detection network with a channel attention mechanism, and use the deep learning model to identify defects in the preprocessed image and accurately locate the type and position of the defective region; and ​ S4. Based on the deep learning model, utilize the multi-scale feature fusion mechanism to extract the preprocessed image features of different scales and fuse them, process the fused different-scale feature maps, and detect the tiny defects and details in the complex background; S5. Conduct a temporal dynamic analysis on the defect areas identified by the deep learning model, predict the evolution trend of the defects based on the historical evolution dataset of the defect areas, and adjust the preset defect detection strategy according to the prediction results; S6. Build an edge computing platform, implement a distributed defect detection system on the edge computing platform, allocate the image processing and defect analysis tasks to multiple distributed defect detection systems, and complete the circuit board defect detection task in real time; The specific content of S3 includes: S31. Merge the defect candidate region layer with the preprocessed image and input it into a deep learning model, which includes an object detection network and a channel attention mechanism, for feature extraction and object detection, for optimizing the channel attention of image features to generate a composite image input; S32. Conduct normalization processing on the composite image input, including gray normalization, color normalization, and texture enhancement, to realize the expression of multi-scale features in the deep learning model and optimize the sensitivity of the tiny defect area; S33. Input the standardized composite image into the network for forward propagation, extract multi-level features of the image through the convolutional neural network layer, perform region prediction based on the preset anchor boxes, and generate the confidence, position coordinates, and size information of each potential defect region; S34. Application The channel attention mechanism adjusts the multi-level features of the image. By calculating the attention weights of each channel, it dynamically adjusts the influence of each part in the image, accurately locates the defect area, and optimizes the feature expression of the defect area. S35. Post-process the defect area information output by the combined model, set a confidence threshold to screen the results, eliminate the detection areas with low confidence, and classify the detected defect areas according to the confidence, position coordinates, and size information of the defect areas to identify the types of defect areas. and Post-process the defect area information output by the combined model, set a confidence threshold to screen the results, eliminate the detection areas with low confidence, and classify the detected defect areas according to the confidence, position coordinates, and size information of the defect areas to identify the types of defect areas.

2. The method for detecting surface defects of a circuit board according to claim 1, wherein The specific content of S2 includes: S21. Divide the preprocessed image into multiple pixel units, where each pixel unit includes a target pixel and its adjacent pixels, and define the initial pixel point as , the target pixel is , and the target pixel and its adjacent pixels are defined as the neighborhood set ; S22, Calculate the target pixel and its adjacent pixels to obtain the similarity metric function between them. The similarity metric function combines the differences in the gray value , color value and texture feature value of the target pixel: ; Among them, , , are the weighting coefficients of grayscale, color, and texture features respectively, represents the pixel adjacent to the target pixel 's grayscale value, represents the pixel adjacent to the target pixel 's color value, represents the pixel adjacent to the target pixel 's texture feature value, represents the absolute value operation; S23. Set the similarity metric threshold , when the similarity metric function of the target pixel and the adjacent pixel is less than or equal to the similarity metric threshold , it is considered that the adjacent pixel belongs to the defect area where the target pixel is located; S24. Using the region growing algorithm, starting from each initial pixel point and based on the similarity metric function and the set similarity metric threshold , gradually expand the adjacent pixels and classify the adjacent pixels that meet the conditions into the expanded defect region until the region growing is completed; S25. For the expanded defect area perform screening to eliminate areas with too small an area and too large an overlap with other defect areas. The elimination criteria are determined by calculating the area of the defect area and the overlap degree: ; Among them, refers to another defective area for comparing the overlap degree with the extended defective area ; S26. Mark the expanded defective area that meets the conditions as a potential defective area and generate a defective candidate area layer.

3. The method for detecting surface defects of a circuit board according to claim 1, wherein, The specific content of S4 includes: S41. Based on the deep learning model, use the multi-scale feature fusion mechanism to extract features of each scale from the preprocessed image, and through the convolutional neural network and the multi-level feature pooling structure, obtain the image features from the low level and the high level, and generate a multi-scale feature map ; S42. Normalize the multi-scale feature maps Perform normalization processing, calculate the mean and standard deviation for the feature maps of each scale, and perform zero-mean unit-variance normalization: ; Among them, and are the mean and standard deviation of the feature maps at each scale, is the multi-scale feature map after standardization; S43. Perform multi-level convolution processing on the standardized multi-scale feature maps using a convolutional neural network with a pyramid structure to extract detailed features at different levels, and fuse the low-level and high-level image features to generate a global information feature map to optimize the perception ability for tiny defects and complex backgrounds; S44. Use a weighted fusion mechanism to process the global information feature map for weighted processing, adjust the contribution ratio of the detailed features at different levels, and the weighting coefficient is calculated according to the similarity between the global information feature map of each layer and the defect area as follows: ; Among them, is the similarity measure between the layer global information feature map and the defect area, is the hyperparameter for controlling the weighting coefficient, and the weighted feature map optimizes the influence of high-level features in defect area recognition through layer-by-layer weighting, is the similarity measure between the layer global information feature map and the defect area; S45. On the weighted feature map apply the adaptive activation function , and optimize the performance of important regions in the image by dynamically adjusting the feature values of each defect region: ; Among them, is the feature map after adaptive activation, is the non-linear activation function, is element-wise multiplication, is the dynamic weight map calculated based on the attention mechanism, which can perform dynamic weighting according to the feature importance of local regions of the image; S46. Post-process the feature map after adaptive activation to screen out the feature defect regions that meet the confidence threshold . The confidence threshold controls the confidence of the detected potential defect regions. After removing the low-confidence regions, classify the detected defect regions according to the confidence, position coordinates, and size information of the remaining defect regions to identify the specific defect region types and positions: ; Among them, is the set of filtered defect regions, is the confidence level of the defect region, represents a candidate defect region formed by expanding the initial seed point through the region growing algorithm.

4. The method for detecting surface defects of a circuit board according to claim 3, wherein The specific content of S45 includes: S451. On the weighted feature map apply the adaptive activation function , and optimize the performance of important defect regions in the image by dynamically adjusting the feature values of each defect region; S452. Calculate the weighted feature map and generate a dynamic weight map by calculating the attention degree of each region : ; Among them, and are the mean and standard deviation of the weighted feature map respectively, is the activation function; S453. Multiply the dynamic weight map element - by - element with the weighted feature map to generate an adaptive activation feature map , optimize the contribution of important feature regions and suppress the influence of irrelevant regions by dynamically adjusting the response values of each region; S454. Post-process the adaptive activation feature map to further optimize the image features by analyzing the context information of the local area, optimize the expression of the defective area, and refine the detection effect of the defective area; S455. For the feature map after adaptive activation and post-processing Perform precise detection and classification of defect areas. Based on the adaptive activation feature map, identify potential defect areas, and classify the defects according to the confidence level, position coordinates, and size information of the defect areas to determine the type and precise location of the defects.

5. The method for detecting surface defects of a circuit board according to claim 1, wherein The specific content of S5 includes: S51. Conduct a temporal dynamic analysis on the defect regions identified by the deep learning model, obtain the change data of the defect regions at different time points, and construct a historical evolution data set , where , is the defect region detected at time moment, is a set of time series, representing the evolution trajectory of the defect region on the time axis; S52. Use the time series modeling algorithm for the historical evolution data set to perform modeling, and use the long short-term memory network to learn the evolution law of the defect area in the time dimension to obtain the time series feature vector , where represents the defect evolution feature generated by the time series network, reflecting the change trend of the defect area on the time axis represents the defect evolution feature function; S53. Process the time series feature vector to extract the key dynamic features in the evolution process of the defect area, and obtain the predicted value of the defect evolution trend , where , is a prediction function, indicating that by learning the historical evolution features, the evolution trend and change direction of the future defect area are predicted; S54. Based on the predicted value of the defect evolution trend , infer the future evolution state of the defect area, and dynamically adjust the preset defect detection strategy according to the evolution trend. The adjustment of the defect detection strategy is based on the historical evolution data set and the time series feature vector , and form a new defect detection strategy by adjusting the size of the detection time window, the detection threshold, the region division and the feature extraction method , where is the detection strategy adjustment function is the adjusted detection strategy; S55. According to the adjusted detection strategy , defect detection is performed on the image features adjusted through multi-level feature fusion and temporal dynamic analysis, the region selection, feature extraction, and model parameters in the defect detection process are optimized, and gradual optimization is carried out according to the evolution trend of the current defect region, so as to keep the detection results of the defect region consistent at different time nodes, and the final detection result set is obtained , where is the defect region after optimized detection, is the set of regions finally identified, represents a set in an element, that is, a finally confirmed defect region.

6. A circuit board surface defect detection system for implementing the circuit board surface defect detection method according to any one of claims 1-5, characterized in that, It includes the following modules: Data acquisition module: Real-time collect the circuit board surface image data to generate the original image data; Preprocessing module: Denoise, enhance the contrast, and normalize the collected original image data to generate a preprocessed image; Deep learning model module: Adopt the object detection network and the deep learning model with channel attention mechanism to identify and locate the defective candidate area layer, extract features through a convolutional neural network, and detect the types and positions of defects on the circuit board; Temporal dynamic analysis module: Conduct temporal dynamic analysis based on the historical evolution dataset of the defect areas, use the temporal dynamic analysis method to predict the evolution trend of the defects, and adjust the preset defect detection strategy according to the prediction results; Defect detection module: Based on the historical data of the defect areas, apply the prediction model to calculate the future evolution trend of the defects, and assist the system to dynamically adjust the detection strategy; Defect detection strategy adjustment module: Dynamically adjust the defect detection strategy according to the prediction results of the defect evolution trend, and optimize the parameter settings and detection methods in the defect detection process; Final detection result output module: According to the detection results of the defect areas by the deep learning model and the prediction of the defect evolution trend by the temporal dynamic analysis module, comprehensively process all detection information to generate the final defect detection result.

Citation Information

Patent Citations

  • Bearing ring full-surface defect detection method

    CN118071712A

  • Fan gearbox fault image recognition method and system

    CN119412287A

  • Method and system for analyzing defects in wafer manufacturing based on big data

    CN119580022A