Electronic component surface defect analysis system based on attention mechanism
By introducing key defect concentration algorithm based on attention mechanism and Fourier transform analysis algorithm in the surface defect analysis system of electronic components, the problem that existing systems cannot effectively identify and locate defects is solved, and more efficient and accurate defects are achieved Detection and analysis.
Patent Information
- Application Number
- CN202411493118.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-14
AI Technical Summary
The existing surface defect analysis system of electronic components based on attention mechanism cannot fully extract and analyze key defect information in the image, resulting in low defect recognition rate, inaccurate positioning, and ineffective processing of complex defects, affecting the system's surface The comprehensive analysis ability of defects reduces overall detection accuracy and efficiency.
A key defect concentration algorithm based on attention mechanism was designed, combined with the YOLOv3 network structure and feature pyramid network, intelligently focus key areas in the image through the attention mechanism module, enhance the weight of key features, and analyze the algorithm through Fourier transform Identify and classify defects.
It improves the accuracy and efficiency of defect detection, enhances the system's ability to handle complex defects, ensures a comprehensive analysis of surface defects, and improves the accuracy and reliability of overall detection.
Smart Images

Figure CN119444696A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of attention mechanism, defect detection and Fourier transform, and in particular to an electronic component surface defect analysis system based on attention mechanism. Background Art
[0002] Attention mechanism technology is a deep learning technology that aims to solve the problem of extracting key information in image processing tasks. Attention mechanism technology effectively highlights the important parts of the image by dynamically adjusting the model's attention to different areas in the image, thereby improving the accuracy of defect detection. In the surface defect analysis of electronic components, attention mechanism technology can help the system better identify and locate potential defective areas, reduce the interference of background noise, and ensure the accuracy of detection results.
[0003] Defect detection and Fourier transform technology is an image analysis technology used for defect detection. It aims to address the limitations of traditional defect detection and analysis methods in the identification of surface defects in complex electronic components. Fourier transform technology can convert images into the frequency domain and effectively separate image features of different frequencies, thereby enhancing the significance of defects. In the analysis of surface defects of electronic components, the combination of defect detection and Fourier transform technology can provide more accurate defect detection and classification analysis results.
[0004] However, the existing electronic component surface defect analysis system based on the attention mechanism cannot fully extract and analyze the key defect information in the image, resulting in low defect recognition rate, inaccurate positioning, and inability to effectively handle the diversity of complex defects, affecting the system's comprehensive analysis capabilities of surface defects and reducing the overall detection accuracy and efficiency. Summary of the invention
[0005] The purpose of the present invention is to provide an electronic component surface defect analysis system based on an attention mechanism, so as to solve the problem that the existing electronic component surface defect analysis system based on an attention mechanism proposed in the above background technology cannot fully extract and analyze key defect information in the image, resulting in low defect recognition rate and inaccurate positioning, and cannot effectively handle the diversity of complex defects, affecting the system's comprehensive analysis capability of surface defects and reducing the overall detection accuracy and efficiency.
[0006] To achieve the above-mentioned purpose, the present invention provides the following technical solutions: a surface defect analysis system for electronic components based on an attention mechanism, comprising an image acquisition module, a data processing module, an attention mechanism module, a surface defect analysis module, a system maintenance and feedback update module, and a report generation and user interface module, characterized in that: the image acquisition module is used to acquire image data on the surface of electronic components to ensure that the acquired image has sufficient resolution for subsequent processing and analysis; the data processing module comprises a data preprocessing unit and a feature extraction unit; the data preprocessing unit is used to perform preprocessing operations on the acquired image data, including noise removal and normalization operations, so as to improve the quality of the image and make the preprocessed data suitable for subsequent feature extraction and analysis; the feature extraction unit is used to extract key features that are helpful for defect detection from the preprocessed image, including texture, edge, and shape feature information, and pass them as input data to the subsequent analysis module; the attention mechanism module proposes a method based on attention. The key defect concentration algorithm of the intention mechanism is used to enhance the weight of key features by focusing on important areas in the image, thereby improving the accuracy and efficiency of defect detection. The surface defect analysis module includes a surface defect positioning unit and a defect detection and classification unit. The surface defect positioning module is used to accurately calibrate the position of the defect on the surface of the component, generate the position information of the defect, and pass the position information to the defect detection and classification unit. The defect detection and classification unit proposes a surface defect analysis algorithm based on Fourier transform, which is used to identify surface defects in the image and analyze the extracted features to identify various defect types, including scratches, cracks and contamination defect information. The system maintenance and feedback update module is used to perform daily maintenance on the system and update the system settings according to the defect analysis feedback to ensure the stable and efficient operation of the system. The report generation and user interface module is used to generate a detailed report of the detection results and provide a user interaction interface to ensure that the user can view and manage the detection results.
[0007] Preferably, the image acquisition module controls the acquisition of images of the surface of electronic components by using a high-resolution camera, captures high-definition images of the surface of electronic components in real time, and ensures that the acquired images have high resolution, thereby providing reliable basic image data for subsequent data processing and defect analysis.
[0008] Preferably, the data processing module includes a data preprocessing unit, which ensures that the image quality meets the analysis standard by performing denoising, enhancement and normalization preprocessing operations on the original image data, thereby reducing the impact of interference factors on defect detection.
[0009] Preferably, the data processing module includes a feature extraction unit, which provides effective feature representation for subsequent defect detection by extracting key features in the image, including texture, edge, and shape feature information, thereby ensuring that the system can accurately identify the characteristics of surface defects of electronic components.
[0010] Preferably, the attention mechanism module proposes a key defect concentration algorithm based on the attention mechanism, which intelligently focuses on key areas in the surface image of electronic components, ensuring that the system can highlight and prioritize defective parts of the surface of electronic components, thereby improving the accuracy and efficiency of defect detection.
[0011] Specifically, the key defect concentration algorithm based on the attention mechanism is as follows: First, the image data set of surface defects of electronic components processed by the data processing module is clustered with the marked truth value frame using the K-means clustering algorithm to generate an initial reference prior frame as the key defect concentration algorithm based on the attention mechanism. The specific formula is expressed as follows:
[0012]
[0013] Among them, D(x i ) is represented by the data point x i The distance to the k cluster centers, D represents the distance function, x 1 Represented as the first sample point in the image dataset of electronic component surface defects, x 2 Represented as the second sample point in the image dataset of electronic component surface defects, x i Represented as the i-th sample point in the image dataset of electronic component surface defects, u 1 Represents the first selected cluster center, u 2 Represents the selected second cluster center, u r It represents the selected r-th cluster center, r represents the number index of cluster centers, ||·|| represents the Euclidean distance, and argmin represents the minimum value function. The K-means clustering algorithm is used to provide a good starting point for the subsequent defect detection algorithm to ensure that the algorithm can effectively detect defects of different sizes and shapes. Then, the YOLOv3 network is constructed, and the attention mechanism is integrated into the YOLOv3 network structure. The convolution block attention module is added after each residual unit to enhance the network's ability to obtain key information of the image. The specific formula is expressed as:
[0014]
[0015] Among them, M c(F) represents the output feature map after processing by the channel attention module, which is used to adjust the importance weights of each channel in the input feature map F, enhance the representation of important features, and suppress unimportant features. F represents the feature map input to the channel attention module, representing a multi-channel image data structure, which contains the original feature information output by the convolutional layer. ξ represents the sigmoid activation function. MLP represents a multi-layer perceptron, which is used to learn the nonlinear mapping from the features obtained by global average pooling and maximum pooling to channel weights. It is represented as a convolution operation, AvgPool(F) represents a global average pooling operation on the feature map F to obtain a compressed spatial feature representation, which is used to aggregate the spatial information in each channel into a single global spatial feature, and is represented as a global maximum pooling operation on the feature map F to extract the most significant spatial features in each channel. By constructing a YOLOv3 network structure with an integrated convolutional attention module, the feature maps of the channel and spatial dimensions are processed separately to adaptively adjust the weights of the feature maps, thereby improving the response to key defects and improving the detection accuracy of subsequent modules. Secondly, a multi-scale feature fusion strategy is constructed through the feature pyramid network structure to effectively fuse semantic information at different levels to enhance the algorithm's detection ability for defects of different sizes. The specific formula is expressed as:
[0016] F up =Upsample(F low )
[0017] F fuse =Concat(F up ,F high )
[0018] Among them, F up It is represented by upsampling from the low-resolution feature map F low The obtained resolution feature map, Upsample represents the upsampling operation achieved by the interpolation method, F low It is represented as a low-level feature map with lower resolution but more semantic information extracted from the deeper level of the convolutional block attention module, F fuse It is represented as the fused feature map, which combines the information from feature maps at different levels and can simultaneously include high-level semantic information and low-level detail information of image data. Concat is represented as the operation function that concatenates two feature maps in the channel dimension. up Represented as the feature map obtained by upsampling, used to compare with the high-level feature map F high Fusion, F highIt is represented as a feature map with higher resolution but less semantic information extracted from the shallower level of the convolutional block attention module. In the feature pyramid network, the low-level feature map provides rich semantic information, and the high-level feature map provides precise location information. Through feature fusion, the algorithm can better handle targets of different scales and improve the accuracy of target detection. Then, a loss function combining generalized intersection-over-union loss and focal loss is designed to solve the problem of class imbalance and inaccurate bounding box positioning in target detection. The specific formula is expressed as:
[0019] L=1-GIoU+α(1-p) γ log(p)
[0020] Among them, L is the loss function that measures the difference between the model prediction and the actual result, GIoU is the generalized intersection-over-union ratio that measures the overlap between the predicted bounding box and the true bounding box, p is the probability that the algorithm predicts that the bounding box of the image data contains the target defect, α is the coefficient that balances the weights of defect-free image data and defective image data, γ is the hyperparameter that adjusts the weights of easy-to-classify sample data and difficult-to-classify sample data, log is the logarithmic function, and finally, the model is trained through the designed loss function and the network structure integrated with the attention mechanism. The model parameters are adjusted by iterative training on the training set to achieve the required detection accuracy. The specific formula is expressed as follows:
[0021] W new =W old -η▽ L
[0022] Among them, W new Represented as the updated network weight vector, the weight of the model is updated through the optimization algorithm to minimize the loss function, thereby improving the performance of the model, W old represents the network weight vector before the current iteration, η represents the learning rate, ▽ L Expressed as the gradient of the loss function with respect to the network weights, through the integration of the attention mechanism and multi-scale feature fusion, the key defect concentration algorithm based on the attention mechanism is able to focus on the key defects in the image data and improve the robustness and accuracy of the model through the optimized loss function.
[0023] Preferably, the surface defect analysis module includes a surface defect positioning unit, which determines the specific position of the defect on the surface of the component by analyzing the position information in the image, thereby ensuring that the defect area can be accurately marked and identified.
[0024] Preferably, the surface defect analysis module includes a defect detection and classification unit, which proposes a surface defect analysis algorithm based on Fourier transform to identify and classify the types of detected defects, ensuring that different types of defects can be distinguished, including scratches, cracks, and contamination defect information, thereby providing accurate information for subsequent quality control.
[0025] Specifically, the Fourier transform-based surface defect analysis algorithm is as follows: First, the surface image data of the electronic components after the concentrated defects processed by the attention mechanism module is used as the test image, and the test image data is matched with the known defect-free template image data. By comparing the difference between the test image and the template image, the potential defect area is preliminarily identified. The specific formula is expressed as:
[0026] I test (x,y)=I template (x,y)+D(x,y)
[0027] Among them, I test (x, y) represents the pixel intensity value of the test image in the spatial domain, x and y represent the horizontal and vertical coordinates of the image respectively, template It is represented as the pixel intensity value of the template image in the spatial domain, and D(x,y) is represented as the difference information between the test image and the template image. Then, the matched image is subjected to Fourier transform to convert the image from the spatial domain to the frequency domain. The specific formula is expressed as follows:
[0028]
[0029] Among them, F(u,v) represents the result of the image in the frequency domain after Fourier transform, u and v correspond to the frequency components of the image in the horizontal and vertical directions respectively, F(u,v) contains the information of all frequency components of the image and is the basis for frequency analysis, M represents the number of pixels in the horizontal direction of the image, N represents the number of pixels in the vertical direction of the image, I(x,y) represents the pixel intensity value of the image in the spatial domain, e represents the base of the natural logarithm, and i represents the imaginary unit. It is expressed as a complex exponential function, which is used to convert the pixel value in the spatial domain to the frequency domain. Secondly, by comparing the frequency components of the test image and the template image in the frequency domain, the features related to the surface defects are extracted. By analyzing the difference in frequency components, the defects can be accurately located and identified. The specific formula is expressed as:
[0030] ΔF(u,v)=|F test (u,v)-F template (u,v)|
[0031] Among them, ΔF(u,v) represents the difference in the corresponding frequency components of the test image and the template image in the frequency domain, F test (u,v) represents the Fourier transform result of the test image, F template (u,v) is represented as the Fourier transform result of the template image, and |·| is represented as the absolute value operator. Then, the extracted defect features are transformed back to the spatial domain through inverse Fourier transform to intuitively display the defect position and morphology. The specific formula is expressed as:
[0032]
[0033] Among them, I recon (x, y) represents the pixel intensity value of the reconstructed image in the spatial domain, and θ represents the normalization factor. Finally, the reconstructed defect image is analyzed and classified to determine the type and severity of the defect, providing decision support for the quality control of electronic components. The specific formula is expressed as follows:
[0034] C = classify(I recon ,Θ,S)
[0035] Among them, C represents the final classification result, classify represents the classification function, Θ represents the parameter set of the classification model, including the feature weights, threshold parameters, and decision boundary parameters learned by the model, and S represents the feature set extracted from the reconstructed image. The surface defect analysis algorithm based on Fourier transform provides an accurate and efficient solution for surface defect detection of electronic components. The algorithm can more sensitively capture subtle changes in surface defects, improve the detection capability of the system, and ensure the accuracy and reliability of an electronic component surface defect analysis system based on the attention mechanism in the process of electronic component surface defect detection and analysis.
[0036] Preferably, the system maintenance and feedback update module collects data and user feedback during system operation, regularly updates and optimizes system configuration, ensures that the system always maintains efficient and accurate defect detection capabilities, and adapts to new defect types and process changes.
[0037] Preferably, the report generation and user interface module generates a report containing the test results to ensure that the user can understand the status of the surface of the electronic components in a timely manner, and provides an efficient user interface to facilitate viewing and management of the test results, thereby improving the usability and operating efficiency of the system.
[0038] Compared with the prior art, the present invention has the following beneficial effects:
[0039] 1. Attention mechanism module A key defect concentration algorithm based on the attention mechanism is proposed. First, the K-means clustering algorithm is used to cluster the marked truth boxes of the surface defect image dataset of electronic components processed by the data processing module to generate the initial reference prior box as the attention mechanism. This step provides a good starting point for the subsequent defect detection algorithm, ensuring that the algorithm can effectively detect different defect sizes and shapes, thereby improving the system's ability to handle complex defects. Then, the attention mechanism is integrated into the YOLOv3 network structure. By adding a convolutional block attention module after each residual unit, the network's ability to obtain key information of the image is enhanced. The attention mechanism adaptively highlights the defect-related areas in the image by adjusting the weights of the channel and spatial dimension feature maps, thereby improving the system's response to key defects and the accuracy of subsequent detection modules. At the same time, a feature pyramid network structure is used to construct a multi-scale feature fusion strategy to effectively fuse semantic information at different levels, further enhancing the system's ability to detect defects of different sizes. By combining low-level features, the system can effectively detect defects of different sizes. The semantic information of the feature map and the position information of the high-level feature map enable the system to better handle targets of different scales, thereby improving the accuracy and robustness of the overall detection. Finally, by designing a loss function that combines the generalized intersection-over-union loss and the focal loss, the algorithm effectively solves the problems of category imbalance and inaccurate bounding box positioning. The optimized loss function makes the model more stable when dealing with defects of different complexities, and continuously improves the detection accuracy by iteratively updating the model parameters during the training process. In summary, the key defect concentration algorithm based on the attention mechanism performs well in the recognition and classification of complex defects through the focus on key areas, multi-scale fusion of features and optimized loss function design, which greatly improves the detection performance and reliability of the system.
[0040] 2. The defect detection and classification unit proposes a surface defect analysis algorithm based on Fourier transform. First, the algorithm uses the attention mechanism module to process the surface images of electronic components and concentrates the image data after defects as the test image. By matching the test image with a known defect-free template image, the algorithm can preliminarily identify the potential defect area. The matching process achieves preliminary screening of possible defect areas by comparing the differences between the test image and the template image to form a difference information map. Then, the matched image is Fourier transformed to convert the image from the spatial domain to the frequency domain. The Fourier transform can reveal the frequency components in the image, allowing the system to perform further analysis in the frequency domain. The representation of the image in the frequency domain can accurately capture the periodicity and structural characteristics of the image, which is particularly important for the identification of surface defects. By comparing the frequency components of the test image and the template image in the frequency domain, the frequency features related to the defect can be extracted. In particular, defects often appear as anomalies of specific frequency components. Often, the algorithm can accurately locate defects by analyzing the differences in frequency components. After identifying the frequency components related to the defects, the system uses inverse Fourier transform to convert the frequency features back to the spatial domain to intuitively display the location and shape of the defects. In this way, the system can not only detect defects, but also provide detailed defect morphology information for quality control. Finally, the system analyzes and classifies the reconstructed defect images, determines the type and severity of the defects through the classification model, and uses the extracted frequency features and spatial domain features to classify the defects into different types, thereby evaluating their impact on product quality. In summary, the surface defect analysis algorithm based on Fourier transform provides an accurate and efficient solution for surface defect detection of electronic components. The algorithm can more sensitively capture subtle changes in surface defects, improve the detection capability of the system, and ensure the accuracy and reliability of an electronic component surface defect analysis system based on attention mechanism in the process of electronic component surface defect detection and analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The invention is further illustrated by the accompanying drawings, but the embodiments in the accompanying drawings do not constitute any limitation to the invention. A person skilled in the art can obtain other drawings based on the following drawings without creative work.
[0042] Figure 1 It is a structural schematic diagram of the present invention. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0044] See also Figure 1 The present invention provides an electronic component surface defect analysis system based on an attention mechanism, comprising an image acquisition module, a data processing module, an attention mechanism module, a surface defect analysis module, a system maintenance and feedback update module, and a report generation and user interface module, characterized in that: the image acquisition module is used to acquire image data on the surface of electronic components to ensure that the acquired image has sufficient resolution for subsequent processing and analysis; the data processing module comprises a data preprocessing unit and a feature extraction unit; the data preprocessing unit is used to perform preprocessing operations on the acquired image data, including noise removal and normalization operations, so as to improve the quality of the image and make the preprocessed data suitable for subsequent feature extraction and analysis; the feature extraction unit is used to extract key features that are helpful for defect detection from the preprocessed image, including texture, edge, and shape feature information, and pass them as input data to the subsequent analysis module; the attention mechanism module proposes an attention mechanism-based attention mechanism. The key defect concentration algorithm is used to enhance the weight of key features by focusing on important areas in the image, thereby improving the accuracy and efficiency of defect detection. The surface defect analysis module includes a surface defect positioning unit and a defect detection and classification unit. The surface defect positioning module is used to accurately calibrate the position of defects on the surface of components, generate defect position information, and pass the position information to the defect detection and classification unit. The defect detection and classification unit proposes a surface defect analysis algorithm based on Fourier transform to identify surface defects in images and analyze the extracted features to identify various defect types, including scratches, cracks, and contamination defect information. The system maintenance and feedback update module is used to perform daily maintenance on the system and update the system settings based on defect analysis feedback to ensure stable and efficient operation of the system. The report generation and user interface module is used to generate detailed reports of the test results and provide a user interaction interface to ensure that users can view and manage the test results.
[0045] See also Figure 1 Furthermore, the image acquisition module uses a high-resolution camera to control the acquisition of the surface image of the electronic component, and captures the high-definition image of the surface of the electronic component in real time, ensuring that the acquired image has high resolution, thereby providing reliable basic image data for subsequent data processing and defect analysis.
[0046] See also Figure 1Furthermore, the data processing module includes a data preprocessing unit, which ensures that the image quality meets the analysis standard by performing denoising, enhancement, and normalization preprocessing operations on the original image data, thereby reducing the impact of interference factors on defect detection.
[0047] See also Figure 1 Furthermore, the data processing module includes a feature extraction unit, which provides effective feature representation for subsequent defect detection by extracting key features in the image, including texture, edge, and shape feature information, ensuring that the system can accurately identify the characteristics of surface defects of electronic components.
[0048] See also Figure 1 ,Furthermore, the attention mechanism module proposes a key defect concentration algorithm based on ,attention mechanism, which intelligently focuses on the key areas in the surface image of ,electronic components, ensuring that the system can highlight and prioritize the ,defective parts on the surface of electronic components, thereby improving the ,accuracy and efficiency of defect detection.
[0049] See also Figure 1 ,Furthermore, the key defect concentration algorithm based on the attention mechanism is specifically as follows: First, the image data set of surface defects of electronic components processed by the data processing module is clustered with the marked truth value frame using the K-means clustering algorithm to generate an initial reference prior frame as the key defect concentration algorithm based on the attention mechanism. The specific formula is expressed as:
[0050]
[0051] Among them, D(x i ) is represented by the data point x i The distance to the k cluster centers, D represents the distance function, x 1 Represented as the first sample point in the image dataset of electronic component surface defects, x 2 Represented as the second sample point in the image dataset of electronic component surface defects, x i Represented as the i-th sample point in the image dataset of electronic component surface defects, u 1 Represents the first selected cluster center, u 2 Represents the selected second cluster center, u rIt represents the selected r-th cluster center, r represents the number index of cluster centers, ||·|| represents the Euclidean distance, and argmin represents the minimum value function. The K-means clustering algorithm is used to provide a good starting point for the subsequent defect detection algorithm to ensure that the algorithm can effectively detect defects of different sizes and shapes. Then, the YOLOv3 network is constructed, and the attention mechanism is integrated into the YOLOv3 network structure. The convolution block attention module is added after each residual unit to enhance the network's ability to obtain key information of the image. The specific formula is expressed as:
[0052]
[0053] Among them, M c (F) represents the output feature map after processing by the channel attention module, which is used to adjust the importance weights of each channel in the input feature map F, enhance the representation of important features, and suppress unimportant features. F represents the feature map input to the channel attention module, representing a multi-channel image data structure, which contains the original feature information output by the convolutional layer. ξ represents the sigmoid activation function. MLP represents a multi-layer perceptron, which is used to learn the nonlinear mapping from the features obtained by global average pooling and maximum pooling to channel weights. It is represented as a convolution operation, AvgPool(F) represents a global average pooling operation on the feature map F to obtain a compressed spatial feature representation, which is used to aggregate the spatial information in each channel into a single global spatial feature, and is represented as a global maximum pooling operation on the feature map F to extract the most significant spatial features in each channel. By constructing a YOLOv3 network structure with an integrated convolutional attention module, the feature maps of the channel and spatial dimensions are processed separately to adaptively adjust the weights of the feature maps, thereby improving the response to key defects and improving the detection accuracy of subsequent modules. Secondly, a multi-scale feature fusion strategy is constructed through the feature pyramid network structure to effectively fuse semantic information at different levels to enhance the algorithm's detection ability for defects of different sizes. The specific formula is expressed as:
[0054] F up =Upsample(F low )
[0055] F fuse =Concat(F up ,F high )
[0056] Among them, F up It is represented by upsampling from the low-resolution feature map F low The obtained resolution feature map, Upsample represents the upsampling operation achieved by the interpolation method, Flow It is represented as a low-level feature map with lower resolution but more semantic information extracted from the deeper level of the convolutional block attention module, F fuse It is represented as the fused feature map, which combines the information from feature maps at different levels and can simultaneously include high-level semantic information and low-level detail information of image data. Concat is represented as the operation function that concatenates two feature maps in the channel dimension. up Represented as the feature map obtained by upsampling, used to compare with the high-level feature map F high Fusion, F high It is represented as a feature map with higher resolution but less semantic information extracted from the shallower level of the convolutional block attention module. In the feature pyramid network, the low-level feature map provides rich semantic information, and the high-level feature map provides precise location information. Through feature fusion, the algorithm can better handle targets of different scales and improve the accuracy of target detection. Then, a loss function combining generalized intersection-over-union loss and focal loss is designed to solve the problem of class imbalance and inaccurate bounding box positioning in target detection. The specific formula is expressed as:
[0057] L=1-GIoU+α(1-p) γ log(p)
[0058] Among them, L is the loss function that measures the difference between the model prediction and the actual result, GIoU is the generalized intersection-over-union ratio that measures the overlap between the predicted bounding box and the true bounding box, p is the probability that the algorithm predicts that the bounding box of the image data contains the target defect, α is the coefficient that balances the weights of defect-free image data and defective image data, γ is the hyperparameter that adjusts the weights of easy-to-classify sample data and difficult-to-classify sample data, log is the logarithmic function, and finally, the model is trained through the designed loss function and the network structure integrated with the attention mechanism. The model parameters are adjusted by iterative training on the training set to achieve the required detection accuracy. The specific formula is expressed as follows:
[0059] W new =W old -η▽ L
[0060] Among them, W new Represented as the updated network weight vector, the weight of the model is updated through the optimization algorithm to minimize the loss function, thereby improving the performance of the model, W old represents the network weight vector before the current iteration, η represents the learning rate, ▽ LExpressed as the gradient of the loss function with respect to the network weights, through the integration of the attention mechanism and multi-scale feature fusion, the key defect concentration algorithm based on the attention mechanism is able to focus on the key defects in the image data and improve the robustness and accuracy of the model through the optimized loss function.
[0061] See also Figure 1 Furthermore, the surface defect analysis module includes a surface defect positioning unit, which determines the specific location of the defect on the surface of the component by analyzing the position information in the image, ensuring that the defect area can be accurately marked and identified.
[0062] See also Figure 1 Furthermore, the surface defect analysis module includes a defect detection and classification unit, which proposes a surface defect analysis algorithm based on Fourier transform to identify and classify the types of detected defects, ensuring that different types of defects can be distinguished, including scratches, cracks, and contamination defect information, providing accurate information for subsequent quality control.
[0063] See also Figure 1 ,Furthermore, the Fourier transform-based surface defect analysis algorithm is specifically as follows: First, the surface image data of the electronic components after the concentrated defects processed by the attention mechanism module is used as the test image, and the test image data is matched with the known defect-free template image data. By comparing the difference between the test image and the template image, the potential defect area is preliminarily identified. The specific formula is expressed as:
[0064] I test (x,y)=I template (x,y)+D(x,y)
[0065] Among them, I test (x, y) represents the pixel intensity value of the test image in the spatial domain, x and y represent the horizontal and vertical coordinates of the image respectively, template It is represented as the pixel intensity value of the template image in the spatial domain, and D(x,y) is represented as the difference information between the test image and the template image. Then, the matched image is subjected to Fourier transform to convert the image from the spatial domain to the frequency domain. The specific formula is expressed as follows:
[0066]
[0067] Among them, F(u,v) represents the result of the image in the frequency domain after Fourier transform, u and v correspond to the frequency components of the image in the horizontal and vertical directions respectively, F(u,v) contains the information of all frequency components of the image and is the basis for frequency analysis, M represents the number of pixels in the horizontal direction of the image, N represents the number of pixels in the vertical direction of the image, I(x,y) represents the pixel intensity value of the image in the spatial domain, e represents the base of the natural logarithm, and i represents the imaginary unit. It is expressed as a complex exponential function, which is used to convert the pixel value in the spatial domain to the frequency domain. Secondly, by comparing the frequency components of the test image and the template image in the frequency domain, the features related to the surface defects are extracted. By analyzing the difference in frequency components, the defects can be accurately located and identified. The specific formula is expressed as:
[0068] ΔF(u,v)=|F test (u,v)-F template (u,v)|
[0069] Among them, ΔF(u,v) represents the difference in the corresponding frequency components of the test image and the template image in the frequency domain, F test (u,v) represents the Fourier transform result of the test image, F template (u,v) is represented as the Fourier transform result of the template image, and |·| is represented as the absolute value operator. Then, the extracted defect features are transformed back to the spatial domain through inverse Fourier transform to intuitively display the defect position and morphology. The specific formula is expressed as:
[0070]
[0071] Among them, I recon (x, y) represents the pixel intensity value of the reconstructed image in the spatial domain, and θ represents the normalization factor. Finally, the reconstructed defect image is analyzed and classified to determine the type and severity of the defect, providing decision support for the quality control of electronic components. The specific formula is expressed as follows:
[0072] C = classify(I recon ,Θ,S)
[0073] Among them, C represents the final classification result, classify represents the classification function, Θ represents the parameter set of the classification model, including the feature weights, threshold parameters, and decision boundary parameters learned by the model, and S represents the feature set extracted from the reconstructed image. The surface defect analysis algorithm based on Fourier transform provides an accurate and efficient solution for surface defect detection of electronic components. The algorithm can more sensitively capture subtle changes in surface defects, improve the detection capability of the system, and ensure the accuracy and reliability of an electronic component surface defect analysis system based on the attention mechanism in the process of electronic component surface defect detection and analysis.
[0074] See also Figure 1 ,Furthermore, the system maintenance and feedback update module collects ,data and user feedback during system operation, and regularly updates and ,optimizes the system configuration, ensuring that the system always maintains ,efficient and accurate defect detection capabilities and adapts to new ,defect types and process changes.
[0075] See also Figure 1 ,Furthermore, the report generation and user interface module ensures that the ,user can timely understand the status of the surface of the ,electronic components by generating a report containing the test results, and provides an ,efficient user interface to facilitate viewing and managing the test results, thereby ,improving the usability and operating efficiency of
[0076] When used specifically, first, the image acquisition module is used to obtain image data on the surface of electronic components to ensure that the acquired image has sufficient resolution for subsequent processing and analysis. Then, the data processing module includes a data preprocessing unit and a feature extraction unit. The data preprocessing unit is used to perform preprocessing operations on the acquired image data, including noise removal and normalization operations, to improve the quality of the image and make the preprocessed data suitable for subsequent feature extraction and analysis. The feature extraction unit is used to extract key features that are helpful for defect detection from the preprocessed image, including texture, edge, and shape feature information, and pass it as input data to the subsequent analysis module. Secondly, the attention mechanism module proposes a key defect concentration algorithm based on the attention mechanism, which is used to enhance the weight of key features by focusing on important areas in the image, thereby improving the accuracy of defect detection. Accuracy and efficiency, then, the surface defect analysis module includes a surface defect positioning unit and a defect detection and classification unit. The surface defect positioning module is used to accurately calibrate the position of defects on the surface of components, generate defect location information, and pass the location information to the defect detection and classification unit. The defect detection and classification unit proposes a surface defect analysis algorithm based on Fourier transform to identify surface defects in images and analyze the extracted features to identify various defect types, including scratches, cracks, and contamination defect information. Finally, the system maintenance and feedback update module is used to perform daily maintenance on the system and update the system settings according to the defect analysis feedback to ensure stable and efficient operation of the system. The report generation and user interface module is used to generate a detailed report of the test results and provide a user interaction interface to ensure that users can view and manage the test results.
[0077] Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments, or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An electronic component surface defect analysis system based on attention mechanism, comprising an image acquisition module, a data processing module, an attention mechanism module, a surface defect analysis module, a system maintenance and feedback update module, a report generation and user interface module, characterized in that: The image acquisition module is used to acquire image data on the surface of electronic components to ensure that the acquired image has sufficient resolution for subsequent processing and analysis. The data processing module includes a data preprocessing unit and a feature extraction unit. The data preprocessing unit is used to perform preprocessing operations on the acquired image data, including noise removal and normalization operations, to improve the quality of the image and make the preprocessed data suitable for subsequent feature extraction and analysis. The feature extraction unit is used to extract key features that are helpful for defect detection from the preprocessed image, including texture, edge, and shape feature information, and pass them as input data to the subsequent analysis module. The attention mechanism module proposes a key defect concentration algorithm based on the attention mechanism, which is used to enhance the weight of key features by focusing on important areas in the image, thereby improving the accuracy and efficiency of defect detection. rate, the surface defect analysis module includes a surface defect positioning unit and a defect detection and classification unit, the surface defect positioning module is used to accurately calibrate the position of the defect on the surface of the component, generate the position information of the defect, and transmit the position information to the defect detection and classification unit, the defect detection and classification unit proposes a surface defect analysis algorithm based on Fourier transform, which is used to identify surface defects in the image and analyze the extracted features to identify various defect types, including scratches, cracks and contamination defect information, the system maintenance and feedback update module is used to perform daily maintenance on the system, and update the system settings according to the defect analysis feedback to ensure the stable and efficient operation of the system, the report generation and user interface module is used to generate a detailed report of the test results, and provide a user interaction interface to ensure that the user can view and manage the test results.
2. The electronic component surface defect analysis system based on the attention mechanism according to claim 1, characterized in that: The image acquisition module uses a high-resolution camera to acquire and control the surface image of the electronic component, captures the high-definition image of the surface of the electronic component in real time, and ensures that the acquired image has high resolution, thereby providing reliable basic image data for subsequent data processing and defect analysis.
3. The electronic component surface defect analysis system based on the attention mechanism according to claim 1, characterized in that: The data processing module includes a data preprocessing unit and a feature extraction unit. The data preprocessing unit ensures that the image quality meets the analysis standard by performing denoising, enhancement, and normalization preprocessing operations on the original image data, thereby reducing the impact of interference factors on defect detection; the feature extraction unit extracts key features in the image, including texture, edge, and shape feature information, to provide effective feature representation for subsequent defect detection, ensuring that the system can accurately identify the characteristics of surface defects of electronic components.
4. According to the electronic component surface defect analysis system based on attention mechanism in claim 1, it is characterized in that: The attention mechanism module proposes a key defect concentration algorithm based on the attention mechanism, which intelligently focuses on the key areas in the surface image of the electronic component, ensuring that the system can highlight and prioritize the defective parts of the surface of the electronic component, thereby improving the accuracy and efficiency of defect detection.
5. The electronic component surface defect analysis system based on the attention mechanism according to claim 4 is characterized in that: First, the image dataset of surface defects of electronic components processed by the data processing module is clustered with the K-means clustering algorithm to generate the initial reference prior frame as the key defect concentration algorithm based on the attention mechanism. The specific formula is expressed as: Among them, D(x i ) is represented by the data point x i The distance to the k cluster centers, D represents the distance function, x1 represents the first sample point in the image dataset of surface defects of electronic components, x2 represents the second sample point in the image dataset of surface defects of electronic components, and x i represents the i-th sample point in the image dataset of surface defects of electronic components, u1 represents the first selected cluster center, u2 represents the second selected cluster center, and u r It represents the selected r-th cluster center, r represents the number index of cluster centers, ||·|| represents the Euclidean distance, and argmin represents the minimum value function. The K-means clustering algorithm is used to provide a good starting point for the subsequent defect detection algorithm to ensure that the algorithm can effectively detect defects of different sizes and shapes. Then, the YOLOv3 network is constructed, and the attention mechanism is integrated into the YOLOv3 network structure. The convolution block attention module is added after each residual unit to enhance the network's ability to obtain key information of the image. The specific formula is expressed as: Among them, M c (F) represents the output feature map after processing by the channel attention module, which is used to adjust the importance weights of each channel in the input feature map F, enhance the representation of important features, and suppress unimportant features. F represents the feature map input to the channel attention module, representing a multi-channel image data structure, which contains the original feature information output by the convolutional layer. ξ represents the sigmoid activation function. MLP represents a multi-layer perceptron, which is used to learn the nonlinear mapping from the features obtained by global average pooling and maximum pooling to channel weights. It is represented as a convolution operation, AvgPool(F) represents a global average pooling operation on the feature map F to obtain a compressed spatial feature representation, which is used to aggregate the spatial information in each channel into a single global spatial feature, and is represented as a global maximum pooling operation on the feature map F to extract the most significant spatial features in each channel. By constructing a YOLOv3 network structure with an integrated convolutional attention module, the feature maps of the channel and spatial dimensions are processed separately to adaptively adjust the weights of the feature maps, thereby improving the response to key defects and improving the detection accuracy of subsequent modules. Secondly, a multi-scale feature fusion strategy is constructed through the feature pyramid network structure to effectively fuse semantic information at different levels to enhance the algorithm's detection ability for defects of different sizes. The specific formula is expressed as: F up =Upsample(F low ) F fuse =Concat(F up ,F high ) Among them, F up It is represented as an upsampling operation from a low-resolution feature map F low The obtained resolution feature map, Upsample represents the upsampling operation achieved by the interpolation method, F low It is represented as a low-level feature map with lower resolution but more semantic information extracted from the deeper level of the convolutional block attention module, F fuse It is represented as the fused feature map, which combines the information from feature maps at different levels and can simultaneously include high-level semantic information and low-level detail information of image data. Concat is represented as the operation function that concatenates two feature maps in the channel dimension. up Represented as the feature map obtained by upsampling, used to compare with the high-level feature map F high Fusion, F high It is represented as a feature map with higher resolution but less semantic information extracted from the shallower level of the convolutional block attention module. In the feature pyramid network, the low-level feature map provides rich semantic information, and the high-level feature map provides precise location information. Through feature fusion, the algorithm can better handle targets of different scales and improve the accuracy of target detection. Then, a loss function combining generalized intersection-over-union loss and focal loss is designed to solve the problem of class imbalance and inaccurate bounding box positioning in target detection. The specific formula is expressed as: L=1-GIoU+α(1-p) γ log(p) Among them, L is the loss function that measures the difference between the model prediction and the actual result, GIoU is the generalized intersection-over-union ratio that measures the overlap between the predicted bounding box and the true bounding box, p is the probability that the algorithm predicts that the bounding box of the image data contains the target defect, α is the coefficient that balances the weights of defect-free image data and defective image data, γ is the hyperparameter that adjusts the weights of easy-to-classify sample data and difficult-to-classify sample data, log is the logarithmic function, and finally, the model is trained through the designed loss function and the network structure integrated with the attention mechanism. The model parameters are adjusted by iterative training on the training set to achieve the required detection accuracy. The specific formula is expressed as follows: IN new =In old -η▽ L Among them, W new Represented as the updated network weight vector, the weight of the model is updated through the optimization algorithm to minimize the loss function, thereby improving the performance of the model, W old represents the network weight vector before the current iteration, η represents the learning rate, ▽ L Expressed as the gradient of the loss function with respect to the network weights, through the integration of the attention mechanism and multi-scale feature fusion, the key defect concentration algorithm based on the attention mechanism is able to focus on the key defects in the image data and improve the robustness and accuracy of the model through the optimized loss function.
6. The electronic component surface defect analysis system based on attention mechanism according to claim 1, characterized in that: The surface defect analysis module includes a surface defect positioning unit and a defect detection and classification unit. The surface defect positioning unit determines the specific position of the defect on the surface of the component by analyzing the position information in the image, ensuring that the defect area can be accurately marked and identified; The defect detection and classification unit proposes a surface defect analysis algorithm based on Fourier transform to identify and classify the types of detected defects, ensuring that different types of defects, including scratches, cracks, and contamination defect information, can be distinguished, providing accurate information for subsequent quality control.
7. The electronic component surface defect analysis system based on the attention mechanism according to claim 6, characterized in that: First, the surface image data of the electronic components after the defects are concentrated from the attention mechanism module is used as the test image, and the test image data is matched with the known defect-free template image data. By comparing the difference between the test image and the template image, the potential defect area is preliminarily identified. The specific formula is expressed as: I test (x,y)=I template (x,y)+D(x,y) Among them, I test (x, y) represents the pixel intensity value of the test image in the spatial domain, x and y represent the horizontal and vertical coordinates of the image respectively, template It is represented as the pixel intensity value of the template image in the spatial domain, and D(x,y) is represented as the difference information between the test image and the template image. Then, the matched image is transformed by Fourier transform to convert the image from the spatial domain to the frequency domain. The specific formula is: Among them, F(u,v) represents the result of the image in the frequency domain after Fourier transform, u and v correspond to the frequency components of the image in the horizontal and vertical directions respectively, F(u,v) contains the information of all frequency components of the image and is the basis for frequency analysis, M represents the number of pixels in the horizontal direction of the image, N represents the number of pixels in the vertical direction of the image, I(x,y) represents the pixel intensity value of the image in the spatial domain, e represents the base of the natural logarithm, and i represents the imaginary unit. It is expressed as a complex exponential function, which is used to convert the pixel value in the spatial domain to the frequency domain. Secondly, by comparing the frequency components of the test image and the template image in the frequency domain, the features related to the surface defects are extracted. By analyzing the difference in frequency components, the defects can be accurately located and identified. The specific formula is expressed as: ΔF(u,v)=|F test (u,v)-F template (u,v)| Among them, ΔF(u,v) represents the difference in the corresponding frequency components of the test image and the template image in the frequency domain, F test (u,v) represents the Fourier transform result of the test image, F template (u,v) represents the Fourier transform result of the template image, and · represents the absolute value operator. Then, the extracted defect features are transformed back to the spatial domain through inverse Fourier transform to intuitively display the defect position and morphology. The specific formula is expressed as: Among them, I recon (x, y) represents the pixel intensity value of the reconstructed image in the spatial domain, and θ represents the normalization factor. Finally, the reconstructed defect image is analyzed and classified to determine the type and severity of the defect, providing decision support for the quality control of electronic components. The specific formula is expressed as follows: C=classify(I recon ,Θ,S) Among them, C represents the final classification result, classify represents the classification function, Θ represents the parameter set of the classification model, including the feature weights, threshold parameters, and decision boundary parameters learned by the model, and S represents the feature set extracted from the reconstructed image. The surface defect analysis algorithm based on Fourier transform provides an accurate and efficient solution for surface defect detection of electronic components. The algorithm can more sensitively capture subtle changes in surface defects, improve the detection capability of the system, and ensure the accuracy and reliability of an electronic component surface defect analysis system based on the attention mechanism in the process of electronic component surface defect detection and analysis.
8. The electronic component surface defect analysis system based on attention mechanism according to claim 1, characterized in that: The system maintenance and feedback update module collects data and user feedback during system operation, regularly updates and optimizes system configuration, ensures that the system always maintains efficient and accurate defect detection capabilities, and adapts to new defect types and process changes.
9. The electronic component surface defect analysis system based on attention mechanism according to claim 1, characterized in that: The report generation and user interface module generates a report containing the test results to ensure that the user can understand the status of the surface of the electronic components in a timely manner, and provides an efficient user interface to facilitate viewing and managing the test results, thereby improving the usability and operating efficiency of the system.
Citation Information
Patent Citations
Printed circuit board surface defect positioning and identifying method
CN111260621A
Small sample target identification method based on transfer learning
CN114519803A
PCB surface defect detection method based on frequency domain information double confirmation
CN114663430A
Printed circuit board assembly defect detection and change detection model training method and device
CN116091416A
PCB surface defect detection method and system, electronic equipment and medium
CN116205883A
Cited By
An industrial machine vision recognition and analysis system
CN119785354A
Defect detection method and device for metal shaft parts
CN120009404A
Chip side scratch detection method and system, product and medium
CN120278988A
PCB appearance defect real-time detection algorithm based on edge calculation
CN120375089A
Full-layout defect rapid detection system based on pattern matching and classification
CN120634960A