Circuit board surface defect detection method and system
By combining YOLOv5 with SE-ResNet deep learning model, multi-scale feature fusion and timing dynamic analysis, the problems of high error rate, low efficiency and lack of intelligence of traditional circuit board defect detection methods are solved, and efficient, accurate and intelligent defect detection is achieved, significantly improving the detection quality and efficiency.
Patent Information
- Application Number
- CN202510422549.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2045-04-07
AI Technical Summary
Traditional circuit board defect detection methods rely on manual inspection and simple image processing, have high error rate, low efficiency, unrecognized micro defects and defects in complex backgrounds, and lack intelligence and adaptability, and have slow response speed.
The combined deep learning model of YOLOv5 and SE-ResNet is adopted, combined with multi-scale feature fusion technology and timing dynamic analysis, and through multi-level feature extraction, weighted fusion and adaptive activation, we accurately identify the defect areas in small defects and complex backgrounds, and dynamically adjust the detection strategy according to the defect evolution trend.
It improves the accuracy and robustness of defect detection, significantly improves the quality and efficiency of circuit board detection, can accurately identify defects and dynamically adjust detection strategies in complex environments, reducing false detection and missed detection phenomena.
Smart Images

Figure CN119941726A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of defect detection, and in particular to a circuit board surface defect detection method and system. Background Art
[0002] With the widespread application of electronic equipment, circuit boards, as the core components of electronic products, have a direct impact on the performance and stability of the equipment. Timely detection and repair of circuit board surface defects are important links to ensure the reliability and production efficiency of electronic products. Traditional circuit board defect detection methods mainly rely on manual inspection and automated detection based on simple image processing, which has certain limitations.
[0003] In the prior art, traditional circuit board defect detection methods usually rely on manual experience or inefficient image processing algorithms. These methods have obvious defects in the following aspects: 1. Manual inspection is dominant: Manual inspection relies on manual operation, has a high error rate, and is inefficient, and cannot meet the needs of modern large-scale production.
[0004] 2. Limited image processing capabilities: Existing detection methods based on traditional image processing can usually only identify the significant features of surface defects, ignoring the identification of tiny defects and defects in complex backgrounds, resulting in frequent false detections and missed detections.
[0005] 3. Lack of intelligence and adaptive capabilities: Most traditional methods lack deep learning and adaptive mechanisms, making it difficult to dynamically adjust detection strategies according to the different evolution trends of defects, and difficult to adapt to complex production environments and changing defect types.
[0006] 4. Slow response speed: Traditional methods are often unable to provide real-time detection and rapid feedback when faced with rapid production and high-precision requirements, resulting in limited production efficiency.
[0007] Therefore, how to provide a circuit board surface defect detection method and system is a problem that technical personnel in this field need to solve urgently. Summary of the invention
[0008] One object of the present invention is to propose a circuit board surface defect detection method and system. The present invention makes full use of the YOLOv5 and SE-ResNet joint deep learning model, multi-scale feature fusion technology and time series dynamic analysis. By performing multi-level feature extraction, weighted fusion and adaptive activation on the circuit board surface image, it can accurately identify tiny defects and defective areas in complex backgrounds, and dynamically adjust the detection strategy according to the defect evolution trend. It has the advantages of high efficiency, precision and intelligent adaptation.
[0009] A circuit board surface defect detection method according to an embodiment of the present invention comprises the following steps: S1, obtaining original image data of the circuit board surface, preprocessing the original image data, including denoising, contrast enhancement and standardization, and generating a preprocessed image; S2. Applying a region growing algorithm to the preprocessed image, judging and expanding the defect area by the similarity of adjacent pixels in the image, automatically expanding and marking the potential defect area, and generating a defect candidate area layer; S3, input the defect candidate area layer and the preprocessed image into the pre-built fusion Object detection network and A deep learning model with a channel attention mechanism is used to identify defects in preprocessed images and accurately locate the type and location of defect areas. S4. Based on the deep learning model, the multi-scale feature fusion mechanism is used to extract and fuse the pre-processed image features of different scales, process the fused feature maps of different scales, and detect small defects and details in complex backgrounds; S5. Perform time-series 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; S6. Build an edge computing platform, implement a distributed defect detection system on the edge computing platform, distribute image processing and defect analysis tasks to multiple distributed defect detection systems, and complete circuit board defect detection tasks in real time.
[0010] Optionally, the S2 specifically includes: S21, dividing the preprocessed image into a plurality of pixel units, each pixel unit includes a target pixel and its adjacent pixels, and defining the initial pixel point as , the target pixel is , and the target pixel Its neighboring pixels The relationship between is defined as the neighborhood set ; S22, calculate the target pixel Its neighboring pixels The similarity measurement function between , this similarity measure combines the target pixel Gray value , color value and texture feature values The differences: ; in, , , are the weighting coefficients of grayscale, color and texture features respectively, Represents the target pixel Adjacent pixels The gray value of Represents the target pixel Adjacent pixels The color value of Represents the target pixel Adjacent pixels The texture feature value of Represents absolute value operation; S23. Setting similarity measurement threshold , when the target pixel With adjacent pixels The similarity measure function Less than or equal to the similarity measurement threshold When the adjacent pixels Belongs to the target pixel The defect area; S24, using the region growing algorithm, from each initial pixel Starting from, according to the similarity measurement function And the similarity measurement threshold set , gradually expand adjacent pixels , and the adjacent pixels that meet the conditions Into the expanded defect area , until the region growing is completed; S25, for the expanded defect area Screening is performed to eliminate areas that are too small or overlap too much with other defective areas. The elimination criteria are calculated by calculating the area of the defective area. and overlap Make a judgment: ; in, Refers to the extended defect area Another defect area for overlap comparison; S26: Expanded defective area that meets the conditions Mark them, identify them as potential defect areas, and generate a defect candidate area layer.
[0011] Optionally, the S3 specifically includes: S31, merging the defect candidate area layer with the preprocessed image and inputting it into the deep learning model. The deep learning model includes Object detection network and Channel attention mechanism, Used for feature extraction and target detection, Channel attention for optimizing image features to generate composite image input; S32, standardize the composite image input, including grayscale normalization, color standardization and texture enhancement, realize the expression of multi-scale features in the deep learning model, and optimize the sensitivity of small defect areas; S33, input the standardized composite image The network performs forward propagation. The multi-level features of the image are extracted through the convolutional neural network layer, and the region prediction is performed based on the preset anchor frame to generate the confidence, location coordinates and size information of each potential defect area; S34, Application The channel attention mechanism adjusts the multi-level features of the image. By calculating the attention weight of each channel, it dynamically adjusts the influence of each part of the image, accurately locates the defect area, and optimizes the feature expression of the defect area. S35, yes and The defect area information output by the joint model is post-processed, and the confidence threshold is set to filter the results, and the detection areas with low confidence are eliminated. According to the confidence, position coordinates, and size information of the defect area, the detected defect area is classified to identify the defect area type.
[0012] Optionally, the S4 specifically includes: S41. Based on the deep learning model, the multi-scale feature fusion mechanism is used to extract features of each scale from the preprocessed image. Through the convolutional neural network and multi-level feature pooling structure, image features from low-level and high-level layers are obtained to generate a multi-scale feature map. ; S42. Multi-scale feature map Perform standardization and average the feature maps of each scale and standard deviation Calculation and normalization to zero mean and unit variance: ; in, and is the mean and standard deviation of the feature map at each scale, is the standardized multi-scale feature map; S43. Standardized multi-scale feature map Perform multi-level convolution processing and use a pyramid-structured convolutional neural network to extract detail features at different levels and fuse low-level and high-level image features to generate a global information feature map , optimize the perception of tiny defects and complex backgrounds; S44, using weighted fusion mechanism to global information feature map Perform weighted processing to adjust the contribution ratio of detail features at different levels and the weighting coefficient According to the similarity between each layer's global information feature map and the defect area calculate: ; in, For the The similarity measurement between the layer global information feature map and the defect area, To control the hyperparameters of the weighting coefficients, the weighted feature maps By weighting each layer, the influence of high-level features in defect area identification is optimized. For the Similarity measurement between the layer global information feature map and the defect area; S45. Feature map after weighting Based on this, an adaptive activation function is applied , by dynamically adjusting the feature values of each defect area, the performance of important areas in the image is optimized: ; in, is the feature map after adaptive activation, is a nonlinear activation function, is element-wise multiplication, It is a dynamic weight map calculated based on the attention mechanism, which can dynamically weight according to the importance of features in the local area of the image; S46, feature map after adaptive activation Perform post-processing to filter out those that meet the confidence threshold The confidence threshold controls the confidence of the detected potential defect area. After removing the low-confidence area, the detected defect area is classified according to the confidence, position coordinates, and size information of the remaining defect area to identify the specific defect area type and location: ; in, is the defect area set after screening, is the confidence level of the defect area.
[0013] Optionally, the S45 specifically includes: S451, feature map after weighting Based on this, an adaptive activation function is applied , by dynamically adjusting the feature values of each defect area, the performance of important defect areas in the image is optimized; S452, calculate the weighted feature map The attention level of each area in the , generating a dynamic weight map : ; in, and They are weighted feature maps. The mean and standard deviation of for Activation function; S453, dynamic weight map And the weighted feature map Multiply element by element to generate an adaptive activation feature map , by dynamically adjusting the response value of each area, optimizing the contribution of important feature areas and suppressing the influence of irrelevant areas: S454, adaptive activation feature map Post-processing is performed to further optimize image features by analyzing the contextual information of local areas, optimize the expression of defect areas, and refine the detection effect of defect areas; S455, feature map after adaptive activation and post-processing Accurately detect and classify defective areas, identify potential defective areas based on adaptive activation feature maps, and classify defects according to the confidence, location coordinates and size information of the defective areas to determine the type and exact location of the defects.
[0014] Optionally, the S5 specifically includes: S51. Perform time series dynamic analysis on the defect areas identified by the deep learning model, obtain the change data of the defect areas at different time points, and construct a historical evolution data set ,in , For in time Defective areas detected at all times, It is a collection of time series, representing the evolution trajectory of the defect area on the time axis; S52, using time series modeling algorithms to analyze historical evolution data sets Modeling is performed and the evolution law of the defect area in the time dimension is learned using the long short-term memory network to obtain the time series feature vector ,in, It represents the defect evolution characteristics generated by the timing network, reflecting the changing trend of the defect area on the time axis. represents the defect evolution characteristic function; S53, time series feature vector Processing is performed to extract the key dynamic features of the defect area evolution process and obtain the defect evolution trend prediction value ,in, , is a prediction function, which means predicting the evolution trend and change direction of the defect area in the future by learning the historical evolution characteristics; S54, based on defect evolution trend prediction value , 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 , by adjusting the detection time window size, detection threshold, area division and feature extraction method, a new defect detection strategy is formed. ,in, Adjust the function for the detection strategy, For the adjusted detection strategy; S55. According to the adjusted detection strategy , perform defect detection on image features adjusted by multi-level feature fusion and time series dynamic analysis, optimize region selection, feature extraction and model parameters in the defect detection process, and gradually optimize according to the evolution trend of the current defect region, so that the detection results of the defect region at different time nodes remain consistent, and obtain the final detection result set ,in For the optimized detection defect area, is the final identified area set.
[0015] Optionally, a circuit board surface defect detection system includes the following modules: Data acquisition module: collects circuit board surface image data in real time and generates original image data; Preprocessing module: denoise, contrast enhance and standardize the collected raw image data to generate a preprocessed image; Deep learning model module: using Object detection network and The deep learning model of the channel attention mechanism identifies and locates the defect candidate area layer, and extracts features through the convolutional neural network to detect the defect type and location on the circuit board; Time series dynamic analysis module: It performs time series dynamic analysis based on the historical evolution data set of the defect area, uses the time series dynamic analysis method to predict the evolution trend of the defect, and adjusts the preset defect detection strategy according to the prediction results; Defect detection module: Based on the historical data of the defect area, the prediction model is used to infer the future evolution trend of the defect, and the auxiliary system dynamically adjusts the detection strategy; Defect detection strategy adjustment module: dynamically adjusts the defect detection strategy based on the prediction results of the defect evolution trend, and optimizes the parameter settings and detection methods in the defect detection process; Final detection result output module: Based on the detection results of the defect area by the deep learning model and the prediction of the defect evolution trend by the timing dynamic analysis module, all detection information is comprehensively processed to generate the final defect detection results.
[0016] The beneficial effects of the present invention are: (1) The present invention combines the YOLOv5 and SE-ResNet joint deep learning model, multi-scale feature fusion technology and time series dynamic analysis method to efficiently identify and classify tiny defects and defect areas in complex circuit board surface images. This method improves the accuracy and robustness of defect detection through precise feature extraction and dynamic adjustment, and significantly improves the quality and efficiency of circuit board detection.
[0017] (2) The present invention effectively optimizes the representation of important areas in the image through multi-level feature map fusion and adaptive activation functions, enabling the system to more accurately identify tiny defects on the surface of the circuit board. This not only improves the accuracy of defect identification, but also enhances the detection system's ability to perceive details in complex backgrounds.
[0018] (3) The present invention combines defect evolution trend prediction with dynamic adjustment of detection strategies, so that the system can adjust the detection scheme in time according to historical data to adapt to defects of different types and evolution processes. This innovative method further improves the adaptability of defect detection and reduces the occurrence of false detection and missed detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying 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 of the present invention. In the accompanying drawings: Figure 1 This is an overall framework diagram of a circuit board surface defect detection method and system proposed by the present invention. DETAILED DESCRIPTION
[0020] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, which only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.
[0021] refer to Figure 1 , a circuit board surface defect detection method, comprising the following steps: S1, obtaining original image data of the circuit board surface, preprocessing the original image data, including denoising, contrast enhancement and standardization, and generating a preprocessed image; S2. Applying a region growing algorithm to the preprocessed image, judging and expanding the defect area by the similarity of adjacent pixels in the image, automatically expanding and marking the potential defect area, and generating a defect candidate area layer; S3, input the defect candidate area layer and the preprocessed image into the pre-built fusion Object detection network and A deep learning model with a channel attention mechanism is used to identify defects in preprocessed images and accurately locate the type and location of defect areas. S4. Based on the deep learning model, the multi-scale feature fusion mechanism is used to extract and fuse the pre-processed image features of different scales, process the fused feature maps of different scales, and detect small defects and details in complex backgrounds; S5. Perform time-series 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; S6. Build an edge computing platform, implement a distributed defect detection system on the edge computing platform, distribute image processing and defect analysis tasks to multiple distributed defect detection systems, and complete circuit board defect detection tasks in real time.
[0022] In this implementation, S2 specifically includes: S21, dividing the preprocessed image into a plurality of pixel units, each pixel unit includes a target pixel and its adjacent pixels, and defining the initial pixel point as , the target pixel is , and the target pixel Its neighboring pixels The relationship between is defined as the neighborhood set ; S22, calculate the target pixel Its neighboring pixels The similarity measurement function between , this similarity measure combines the target pixel Gray value , color value and texture feature values The differences: ; in, , , are the weighting coefficients of grayscale, color and texture features respectively, Represents the target pixel Adjacent pixels The gray value of Represents the target pixel Adjacent pixels The color value of Represents the target pixel Adjacent pixels The texture feature value of Represents absolute value operation; S23. Setting similarity measurement threshold , when the target pixel With adjacent pixels The similarity measure function Less than or equal to the similarity measurement threshold When the adjacent pixels Belongs to the target pixel The defect area; S24, using the region growing algorithm, from each initial pixel Starting from, based on the similarity measurement function And the similarity measurement threshold set , gradually expand adjacent pixels , and the adjacent pixels that meet the conditions Into the expanded defect area , until the region growing is completed; S25, for the expanded defect area Screening is performed to eliminate areas that are too small or overlap too much with other defective areas. The elimination criteria are calculated by calculating the area of the defective area. and overlap Make a judgment: ; in, Refers to the extended defect area Another defect area for overlap comparison; S26: Expanded defective area that meets the conditions Mark them, identify them as potential defect areas, and generate a defect candidate area layer.
[0023] This implementation combines the grayscale, color and texture features of the target pixel with those of the adjacent pixels, calculates a similarity measurement function, and uses a region growing algorithm to expand the defect area. This can accurately identify potential defects on the surface of the circuit board, and screen out effective defect areas by eliminating areas that do not meet the conditions, thereby improving the accuracy and precision of defect detection and ensuring the efficiency and reliability of defect identification.
[0024] In this implementation, S3 specifically includes: S31, merging the defect candidate area layer with the preprocessed image and inputting it into the deep learning model. The deep learning model includes Object detection network and Channel attention mechanism, Used for feature extraction and target detection, Channel attention for optimizing image features to generate composite image input; S32, standardize the composite image input, including grayscale normalization, color standardization and texture enhancement, realize the expression of multi-scale features in the deep learning model, and optimize the sensitivity of small defect areas; S33, input the standardized composite image The network performs forward propagation. The multi-level features of the image are extracted through the convolutional neural network layer, and the region prediction is performed based on the preset anchor frame to generate the confidence, location coordinates and size information of each potential defect area; S34, Application The channel attention mechanism adjusts the multi-level features of the image. By calculating the attention weight of each channel, it dynamically adjusts the influence of each part of the image, accurately locates the defect area, and optimizes the feature expression of the defect area. S35, yes and The defect area information output by the joint model is post-processed, and the confidence threshold is set to filter the results, and the detection areas with low confidence are eliminated. According to the confidence, position coordinates, and size information of the defect area, the detected defect area is classified to identify the defect area type.
[0025] This implementation optimizes the detection process of circuit board surface defects by combining the target detection network with the channel attention mechanism. The deep learning model extracts multi-level features of the image and dynamically adjusts the influence of each part of the image, significantly improving the detection sensitivity of tiny defects. This method can accurately locate defective areas and classify and identify them, providing efficient and accurate circuit board surface defect detection capabilities.
[0026] In this implementation, S4 specifically includes: S41. Based on the deep learning model, the multi-scale feature fusion mechanism is used to extract features of each scale from the preprocessed image. Through the convolutional neural network and multi-level feature pooling structure, image features from low-level and high-level layers are obtained to generate a multi-scale feature map. ; S42. Multi-scale feature map Perform standardization and average the feature maps of each scale and standard deviation Calculation and normalization to zero mean and unit variance: ; in, and is the mean and standard deviation of the feature map at each scale, is the standardized multi-scale feature map; S43. Standardized multi-scale feature map Perform multi-level convolution processing and use a pyramid-structured convolutional neural network to extract detail features at different levels and fuse low-level and high-level image features to generate a global information feature map , optimize the perception of tiny defects and complex backgrounds; S44, using weighted fusion mechanism to global information feature map Perform weighted processing to adjust the contribution ratio of detail features at different levels and the weighting coefficient According to the similarity between each layer's global information feature map and the defect area calculate: ; in, For the The similarity measurement between the layer global information feature map and the defect area, To control the hyperparameters of the weighting coefficients, the weighted feature maps By weighting each layer, the influence of high-level features in defect area identification is optimized. For the Similarity measurement between the layer global information feature map and the defect area; S45. Feature map after weighting Based on this, an adaptive activation function is applied , by dynamically adjusting the feature values of each defect area, the performance of important areas in the image is optimized: ; in, is the feature map after adaptive activation, is a nonlinear activation function, is element-wise multiplication, It is a dynamic weight map calculated based on the attention mechanism, which can dynamically weight according to the importance of features in the local area of the image; S46, feature map after adaptive activation Perform post-processing to filter out those that meet the confidence threshold The confidence threshold controls the confidence of the detected potential defect area. After removing the low-confidence area, the detected defect area is classified according to the confidence, position coordinates, and size information of the remaining defect area to identify the specific defect area type and location: ; in, is the defect area set after screening, is the confidence level of the defect area.
[0027] This implementation optimizes the detection accuracy of circuit board surface defects by combining a multi-scale feature fusion mechanism and a weighted fusion strategy. The application of multi-level convolution processing and adaptive activation functions enables the system to accurately identify detail features at different levels and dynamically adjust the performance of defective areas, thereby improving the perception of tiny defects and complex backgrounds, and at the same time improving the accuracy of defect classification and positioning.
[0028] In this implementation, S45 specifically includes: S451, feature map after weighting Based on this, an adaptive activation function is applied , by dynamically adjusting the feature values of each defect area, the performance of important defect areas in the image is optimized; S452, calculate the weighted feature map The attention level of each area in the , generating a dynamic weight map : ; in, and They are weighted feature maps. The mean and standard deviation of for Activation function; S453, dynamic weight map And the weighted feature map Multiply element by element to generate an adaptive activation feature map , by dynamically adjusting the response value of each area, optimizing the contribution of important feature areas and suppressing the influence of irrelevant areas: S454, adaptive activation feature map Post-processing is performed to further optimize image features by analyzing the contextual information of local areas, optimize the expression of defect areas, and refine the detection effect of defect areas; S455, feature map after adaptive activation and post-processing Accurately detect and classify defective areas, identify potential defective areas based on adaptive activation feature maps, and classify defects according to the confidence, location coordinates and size information of the defective areas to determine the type and exact location of the defects.
[0029] This implementation method can dynamically adjust the characteristic values of the defect area by introducing an adaptive activation function and a dynamic weight map, thereby optimizing the performance of the key defect area and suppressing the influence of irrelevant areas. By accurately adjusting the response value of each area, the detection accuracy and classification accuracy of the defect area are significantly improved, and the robustness and refinement ability of the defect detection system in complex backgrounds are enhanced.
[0030] In this implementation, S5 specifically includes: S51. Perform time series dynamic analysis on the defect areas identified by the deep learning model, obtain the change data of the defect areas at different time points, and construct a historical evolution data set ,in , For in time Defective areas detected at all times, It is a collection of time series, representing the evolution trajectory of the defect area on the time axis; S52, using time series modeling algorithms to analyze historical evolution data sets Modeling is performed and the evolution law of the defect area in the time dimension is learned using the long short-term memory network to obtain the time series feature vector ,in, It represents the defect evolution characteristics generated by the timing network, reflecting the changing trend of the defect area on the time axis. represents the defect evolution characteristic function; S53, time series feature vector Processing is performed to extract the key dynamic features of the defect area evolution process and obtain the defect evolution trend prediction value ,in, , is a prediction function, which means predicting the evolution trend and change direction of the defect area in the future by learning the historical evolution characteristics; S54, based on defect evolution trend prediction value , 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 , by adjusting the detection time window size, detection threshold, area division and feature extraction method, a new defect detection strategy is formed. ,in, Adjust the function for the detection strategy, For the adjusted detection strategy; S55. According to the adjusted detection strategy , perform defect detection on image features adjusted by multi-level feature fusion and time series dynamic analysis, optimize region selection, feature extraction and model parameters in the defect detection process, and gradually optimize according to the evolution trend of the current defect region, so that the detection results of the defect region at different time nodes remain consistent, and obtain the final detection result set ,in For the optimized detection defect area, is the final identified area set.
[0031] This implementation method predicts the evolution trend of defect areas by introducing time series dynamic analysis and long short-term memory networks, thereby achieving dynamic adjustment of defect detection strategies. By learning from historical evolution data sets, it is possible to accurately predict the future evolution direction of defect areas, thereby optimizing area selection, feature extraction, and model parameters during the detection process, improving the accuracy and stability of defect detection, and ensuring that the detection results of defect areas at different time nodes are consistent.
[0032] In this embodiment, a circuit board surface defect detection system includes the following modules: Data acquisition module: collects circuit board surface image data in real time and generates original image data; Preprocessing module: denoise, contrast enhance and standardize the collected raw image data to generate a preprocessed image; Deep learning model module: using Object detection network and The deep learning model of the channel attention mechanism identifies and locates the defect candidate area layer, and extracts features through the convolutional neural network to detect the defect type and location on the circuit board; Time series dynamic analysis module: It performs time series dynamic analysis based on the historical evolution data of the defect area, uses the time series dynamic analysis method to predict the evolution trend of the defect, and adjusts the defect detection strategy according to the prediction results; Defect detection module: Based on the historical data of the defect area, the prediction model is used to infer the future evolution trend of the defect, and the auxiliary system dynamically adjusts the detection strategy; Defect detection strategy adjustment module: dynamically adjusts the defect detection strategy based on the prediction results of the defect evolution trend, and optimizes the parameter settings and detection methods in the defect detection process; Final detection result output module: Based on the detection results of the defect area by the deep learning model and the prediction of the defect evolution trend by the timing dynamic analysis module, all detection information is comprehensively processed to generate the final defect detection results.
[0033] Embodiment 1: In order to verify the feasibility of the present invention in implementation, the present invention is applied to the quality inspection laboratory of a large circuit board production enterprise. The enterprise produces a wide variety of circuit boards, covering multiple fields such as communications, computers and consumer electronics. The enterprise needs to perform surface defect detection on each batch of circuit boards to ensure that the product quality meets industry standards. Traditional defect detection methods rely on manual visual inspection or algorithms based on traditional image processing. These methods have great deficiencies in detection efficiency and accuracy. Especially when dealing with complex backgrounds and minor defects, the false detection rate and missed detection rate of traditional methods are high, resulting in unstable detection results, increased production costs, and affecting the product delivery cycle. To solve these problems, the enterprise introduced the circuit board surface defect detection method based on deep learning proposed in the present invention. By combining deep neural networks, time series dynamic analysis and defect evolution trend prediction technology, the defect detection process is optimized and the detection accuracy and efficiency are improved.
[0034] In the experiment, the laboratory selected 100 groups of circuit board samples, covering different models of circuit boards, with different types of defects on the samples, including cracks, holes, offsets and short circuits. The detection environment includes two typical environments: normal temperature and high humidity. The image acquisition equipment used in the experiment is a high-resolution industrial camera, which can provide high-quality circuit board surface images under different lighting conditions. The image data is preprocessed by a deep learning model, and the YOLOv5 and SE-ResNet joint 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 a weighted feature map is obtained. After defect recognition, the identified defect area is further analyzed in time series, and the evolution trend of the defect area is predicted through the long short-term memory network, and the defect detection strategy is dynamically adjusted.
[0035] After the laboratory conducted defect detection using the method of the present invention, the test results obtained were compared with the results of manual detection. The following is part of the experimental data: Table 1 Comparison of circuit board defect detection results Defect Type Detection Methods Detection accuracy Missed detection rate False positive rate crack Traditional methods 85% 10% 8% crack Method of the present invention 98% 2% 3% Holes Traditional methods 82% 12% 5% Holes Method of the present invention 95% 4% 2% Offset Traditional methods 80% 15% 7% Offset Method of the present invention 96% 3% 1% Experimental data show that the method of the present invention has shown significant advantages in all kinds of defect detection, especially in the identification of small defects, with the detection accuracy increased by 13% to 18%, and the missed detection rate and false detection rate significantly reduced. Through time series 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, thereby avoiding missed detection and false detection in complex environments.
[0036] In order to further verify the advantages of the method of the present invention, the laboratory compared the defect detection efficiency before and after the introduction of the technology of the present invention: Table 2 Defect detection efficiency comparison Detection scenario Average detection time (seconds) Testing time per batch (minutes) Improvement in detection accuracy (%) Traditional methods 90 30 - Method of the present invention 45 15 35 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, reduces the detection time of each batch from 30 minutes to 15 minutes, and improves the detection accuracy by 35%. This significant efficiency improvement makes the defect detection of circuit boards in large-scale production more efficient and meets the quality control needs of enterprises in mass production.
[0037] In order to further demonstrate the practical application effect of the present invention, the laboratory also analyzed the test results under multiple environments, including normal temperature and high humidity conditions. In a high humidity environment, water droplets or haze are easily generated on the surface of the circuit board, and traditional defect detection methods are often interfered with, resulting in increased false detection rate and missed detection rate. The present invention combines time series dynamic analysis and adaptive activation function to optimize image features, effectively improving the detection stability in a humid environment. The following is the test data in a high humidity environment: Table 3 Defect detection effect in high humidity environment Defect Type Traditional method detection accuracy The detection accuracy of the method of the present invention crack 70% 96% Holes 75% 93% Offset 65% 90% Experimental data show that in a high humidity environment, the method of the present invention significantly improves the accuracy of defect detection compared with traditional methods. Especially in complex environmental conditions, the system can better adapt to environmental changes and improve the stability of detection.
[0038] In summary, the present invention not only solves the problems of low efficiency and serious false detection and missed detection in traditional defect detection methods, but also makes the defect detection process more intelligent and adaptive by introducing time series dynamic analysis and defect evolution prediction technology. The significant improvement of detection accuracy and efficiency has greatly reduced production costs and improved the quality and delivery speed of circuit board products.
[0039] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A circuit board surface defect detection method, characterized in that: The steps include: S1, obtaining original image data of the circuit board surface, preprocessing the original image data, including denoising, contrast enhancement and standardization, and generating a preprocessed image; S2. Applying a region growing algorithm to the preprocessed image, judging and expanding the defect area by the similarity of adjacent pixels in the image, automatically expanding and marking the potential defect area, and generating a defect candidate area layer; S3, input the defect candidate area layer and the preprocessed image into the pre-built fusion Object detection network and A deep learning model with a channel attention mechanism is used to identify defects in preprocessed images and accurately locate the type and location of defect areas. S4. Based on the deep learning model, the multi-scale feature fusion mechanism is used to extract and fuse the pre-processed image features of different scales, process the fused feature maps of different scales, and detect small defects and details in complex backgrounds; S5. Perform time-series 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; S6. Build an edge computing platform, implement a distributed defect detection system on the edge computing platform, distribute image processing and defect analysis tasks to multiple distributed defect detection systems, and complete circuit board defect detection tasks in real time.
2. The circuit board surface defect detection method according to claim 1, characterized in that: The S2 specifically includes: S21, dividing the preprocessed image into a plurality of pixel units, each pixel unit includes a target pixel and its adjacent pixels, and defining the initial pixel point as , the target pixel is , and the target pixel Its neighboring pixels The relationship between is defined as the neighborhood set ; S22, calculate the target pixel Its neighboring pixels The similarity measurement function between , this similarity measure combines the target pixel Gray value , color value and texture feature values The differences: ; in, , , are the weighting coefficients of grayscale, color and texture features respectively, Represents the target pixel Adjacent pixels The gray value of Represents the target pixel Adjacent pixels The color value of Represents the target pixel Adjacent pixels The texture feature value of Represents absolute value operation; S23. Setting similarity measurement threshold , when the target pixel With adjacent pixels The similarity measure function Less than or equal to the similarity measurement threshold When the adjacent pixels Belongs to the target pixel The defect area; S24, using the region growing algorithm, from each initial pixel Starting from, according to the similarity measurement function And the similarity measurement threshold set , gradually expand adjacent pixels , and the adjacent pixels that meet the conditions Into the expanded defect area , until the region growing is completed; S25, for the expanded defect area Screening is performed to eliminate areas that are too small or overlap too much with other defective areas. The elimination criteria are calculated by calculating the area of the defective area. and overlap Make a judgment: ; in, Refers to the extended defect area Another defect area for overlap comparison; S26: Expanded defective area that meets the conditions Mark them, identify them as potential defect areas, and generate a defect candidate area layer.
3. The circuit board surface defect detection method according to claim 2, characterized in that: The S3 specifically includes: S31, merging the defect candidate area layer with the preprocessed image and inputting it into the deep learning model. The deep learning model includes Object detection network and Channel attention mechanism, Used for feature extraction and target detection, Channel attention for optimizing image features to generate composite image input; S32, standardize the composite image input, including grayscale normalization, color standardization and texture enhancement, realize the expression of multi-scale features in the deep learning model, and optimize the sensitivity of small defect areas; S33, input the standardized composite image The network performs forward propagation. The multi-level features of the image are extracted through the convolutional neural network layer, and the region prediction is performed based on the preset anchor frame to generate the confidence, location coordinates and size information of each potential defect area; S34, Application The channel attention mechanism adjusts the multi-level features of the image. By calculating the attention weight of each channel, it dynamically adjusts the influence of each part of the image, accurately locates the defect area, and optimizes the feature expression of the defect area. S35, yes and The defect area information output by the joint model is post-processed, and the confidence threshold is set to filter the results, and the detection areas with low confidence are eliminated. According to the confidence, position coordinates, and size information of the defect area, the detected defect area is classified to identify the defect area type.
4. The circuit board surface defect detection method according to claim 3, characterized in that: The S4 specifically includes: S41. Based on the deep learning model, the multi-scale feature fusion mechanism is used to extract features of each scale from the preprocessed image. Through the convolutional neural network and multi-level feature pooling structure, image features from low-level and high-level layers are obtained to generate a multi-scale feature map. ; S42. Multi-scale feature map Perform standardization and average the feature maps of each scale and standard deviation Calculation and normalization to zero mean and unit variance: ; in, and is the mean and standard deviation of the feature map at each scale, is the standardized multi-scale feature map; S43. Standardized multi-scale feature map Perform multi-level convolution processing and use a pyramid-structured convolutional neural network to extract detail features at different levels and fuse low-level and high-level image features to generate a global information feature map , optimize the perception of tiny defects and complex backgrounds; S44, using weighted fusion mechanism to global information feature map Perform weighted processing to adjust the contribution ratio of detail features at different levels and the weighting coefficient According to the similarity between each layer's global information feature map and the defect area calculate: ; in, For the The similarity measurement between the layer global information feature map and the defect area, To control the hyperparameters of the weighting coefficients, the weighted feature maps By weighting each layer, the influence of high-level features in defect area identification is optimized. For the Similarity measurement between the layer global information feature map and the defect area; S45. Feature map after weighting Based on this, an adaptive activation function is applied , by dynamically adjusting the feature values of each defect area, the performance of important areas in the image is optimized: ; in, is the feature map after adaptive activation, is a nonlinear activation function, is element-wise multiplication, It is a dynamic weight map calculated based on the attention mechanism, which can dynamically weight according to the importance of features in the local area of the image; S46, feature map after adaptive activation Perform post-processing to filter out those that meet the confidence threshold The confidence threshold controls the confidence of the detected potential defect area. After removing the low-confidence area, the detected defect area is classified according to the confidence, position coordinates, and size information of the remaining defect area to identify the specific defect area type and location: ; in, is the defect area set after screening, is the confidence level of the defect area.
5. The circuit board surface defect detection method according to claim 4, characterized in that: The S45 specifically includes: S451, feature map after weighting Based on this, an adaptive activation function is applied , by dynamically adjusting the feature values of each defect area, the performance of important defect areas in the image is optimized; S452, calculate the weighted feature map The attention level of each area in the , generating a dynamic weight map : ; in, and They are weighted feature maps. The mean and standard deviation of for Activation function; S453, dynamic weight map And the weighted feature map Multiply element by element to generate an adaptive activation feature map , by dynamically adjusting the response value of each area, the contribution of important feature areas is optimized and the influence of irrelevant areas is suppressed; S454, adaptive activation feature map Post-processing is performed to further optimize image features by analyzing the contextual information of local areas, optimize the expression of defect areas, and refine the detection effect of defect areas; S455, feature map after adaptive activation and post-processing Accurately detect and classify defective areas, identify potential defective areas based on adaptive activation feature maps, and classify defects according to the confidence, location coordinates and size information of the defective areas to determine the type and exact location of the defects.
6. The circuit board surface defect detection method according to claim 1, characterized in that: The S5 specifically includes: S51. Perform time series dynamic analysis on the defect areas identified by the deep learning model, obtain the change data of the defect areas at different time points, and construct a historical evolution data set ,in , For in time Defective areas detected at all times, It is a collection of time series, representing the evolution trajectory of the defect area on the time axis; S52, using time series modeling algorithms to analyze historical evolution data sets Modeling is performed and the evolution law of the defect area in the time dimension is learned using the long short-term memory network to obtain the time series feature vector ,in, It represents the defect evolution characteristics generated by the timing network, reflecting the change trend of the defect area on the time axis. represents the defect evolution characteristic function; S53, time series feature vector Processing is performed to extract the key dynamic features of the defect area evolution process and obtain the defect evolution trend prediction value ,in, , is a prediction function, which means predicting the evolution trend and change direction of the defect area in the future by learning the historical evolution characteristics; S54, based on defect evolution trend prediction value , 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 , by adjusting the detection time window size, detection threshold, area division and feature extraction method, a new defect detection strategy is formed. ,in, Adjust the function for the detection strategy, For the adjusted detection strategy; S55. According to the adjusted detection strategy , perform defect detection on image features adjusted by multi-level feature fusion and time series dynamic analysis, optimize region selection, feature extraction and model parameters in the defect detection process, and gradually optimize according to the evolution trend of the current defect region, so that the detection results of the defect region at different time nodes remain consistent, and obtain the final detection result set ,in For the optimized detection defect area, is the final identified area set.
7. A circuit board surface defect detection system, used to implement the circuit board surface defect detection method according to any one of claims 1 to 6, characterized in that: Includes the following modules: Data acquisition module: collects circuit board surface image data in real time and generates original image data; Preprocessing module: denoise, contrast enhance and standardize the collected raw image data to generate a preprocessed image; Deep learning model module: using Object detection network and The deep learning model of the channel attention mechanism identifies and locates the defect candidate area layer, and extracts features through the convolutional neural network to detect the defect type and location on the circuit board; Time series dynamic analysis module: It performs time series dynamic analysis based on the historical evolution data set of the defect area, uses the time series dynamic analysis method to predict the evolution trend of the defect, and adjusts the preset defect detection strategy according to the prediction results; Defect detection module: Based on the historical data of the defect area, the prediction model is used to infer the future evolution trend of the defect, and the auxiliary system dynamically adjusts the detection strategy; Defect detection strategy adjustment module: dynamically adjusts the defect detection strategy based on the prediction results of the defect evolution trend, and optimizes the parameter settings and detection methods in the defect detection process; Final detection result output module: Based on the detection results of the defect area by the deep learning model and the prediction of the defect evolution trend by the timing dynamic analysis module, all detection information is comprehensively processed to generate the final defect detection results.
Citation Information
Patent Citations
Bearing ring full-surface defect detection method
CN118071712A
Ceramic defect intelligent detection method, system and equipment based on deep learning and storage medium
CN119131006A
Semiconductor defect classification and prediction method using deep learning algorithm
CN119131505A
Fan gearbox fault image recognition method and system
CN119412287A
Method and system for analyzing defects in wafer manufacturing based on big data
CN119580022A
Cited By
Fault detection method and system for automobile steering controller
CN120182262A
PCB detection method and device based on artificial intelligence
CN120213978A
Non-contact super-resolution guided wave array imaging method based on deep learning
CN120374394A
A non-contact super-resolution guided wave array imaging method based on deep learning
CN120374394B
Machine learning PCB defect automatic detection system and method
CN120707553A